# Offline push configuration (/en/api-reference/api-ref/im/offline-push/offline-push-configuration)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

<_PlatformTabsGroup groupMode="structured" canonicalPlatform="web" platforms="[&#x22;web&#x22;,&#x22;android&#x22;,&#x22;ios&#x22;,&#x22;flutter&#x22;,&#x22;react-native&#x22;,&#x22;windows&#x22;,&#x22;unity&#x22;]" showTabs="true">
  <_PlatformPanel platform="web">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="web" />

    Push notifications are not available for Web.

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="android">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="android" />

    This page shows how to call Chat RESTful APIs to set the display name, display style, push notification mode, and do-not-disturb (DND) mode.

    Before calling the following methods, ensure that you meet the following:

    * You understand the call frequency limit of the Chat RESTful APIs as described in [Limitations](../limitations#call-limit-of-server-sides).

    * You have activated the advanced features for push in [Agora Console](https://console.agora.io/v2). Advanced features allow you to set the push notification mode, do-not-disturb mode, and custom push template.

    <CalloutContainer type="info">
      <CalloutDescription>
        You must contact [support@agora.io](mailto\:support@agora.io) to disable the advanced features for push as this operation will delete all the relevant configurations.
      </CalloutDescription>
    </CalloutContainer>

    ## Common parameters [#common-parameters]

    The following table lists common request and response parameters of the Chat RESTful APIs:

    ### Request parameters [#request-parameters]

    | Parameter  | Type   | Description                                                                                                                                                                                                                             | Required |
    | :--------- | :----- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
    | `host`     | String | The domain name assigned by the Chat service to access RESTful APIs. For how to get the domain name, see [Get the information of your project](/en/realtime-media/im/get-started/enable#get-the-information-of-the-agora-chat-project). | Yes      |
    | `app_id`   | String | The unique identifier automatically assigned to each project by Agora                                                                                                                                                                   | Yes      |
    | `username` | String | The unique login account of the user.                                                                                                                                                                                                   | Yes      |

    ### Response parameters [#response-parameters]

    | Parameter         | Type   | Description                                                                                          |
    | :---------------- | :----- | :--------------------------------------------------------------------------------------------------- |
    | `action`          | String | The request method.                                                                                  |
    | `organization`    | String | The unique identifier assigned to each company (organization) by the Chat service.                   |
    | `application`     | String | A unique internal ID assigned to each app by the Chat service. You can safely ignore this parameter. |
    | `applicationName` | String | The unique identifier assigned to each app by the Chat service .                                     |
    | `timestamp`       | Number | The Unix timestamp (ms) of the HTTP response.                                                        |
    | `duration`        | Number | The duration (ms) from when the HTTP request is sent to the time the response is received.           |
    | `path`            | String | The request path, which is part of the request URL. You can safely ignore this parameter.            |
    | `uri`             | String | The request URI.                                                                                     |
    | `entities `       | JSON   | The response entity.                                                                                 |
    | `data`            | JSON   | The response details.                                                                                |

    ## Authorization [#authorization]

    Chat RESTful APIs require Bearer HTTP authentication. Every time an HTTP request is sent, the following `Authorization` field must be filled in the request header:

    ```html
    Authorization: Bearer ${YourAppToken}
    ```

    In order to improve the security of the project, Agora uses a token (dynamic key) to authenticate users before they log in to the chat system. Chat RESTful APIs only support authenticating users using app tokens. For details, see [Authentication using App Token](/en/realtime-media/im/build/secure-access-and-authentication/authentication).

    ## Set the display name in push notifications [#set-the-display-name-in-push-notifications]

    Sets the nickname displayed in push notifications.

    For each App Key, the total call frequency limit of this method and the method to set the display style is 100 per second.

    ### HTTP request [#http-request]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{userId}
    ```

    #### Path parameter [#path-parameter]

    | Parameter | Type   | Description                      | Required |
    | :-------- | :----- | :------------------------------- | :------- |
    | `userId`  | String | The user ID of the current user. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#param).

    #### Request header [#request-header]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Accept`        | String | The parameter type. Set it as `application/json`.                                                                                                                                                       | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body]

    | Parameter  | Type   | Description                                                                                                                   | Required |
    | :--------- | :----- | :---------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `nickname` | String | The nickname that is displayed in the push notification bar of the recipient's client when a message from the user is pushed. | No       |

    The length of `nickname` cannot exceed 100 characters. It supports the following character sets:

    * 26 lowercase English letters (a-z)
    * 26 uppercase English letters (A-Z)
    * 10 numbers (0-9)
    * Chinese characters
    * Special characters

    If no nickname is set, when a message from this user is pushed, the user ID of the message sender, instead of the nickname, is indicated in the notification details (`notification_display_style` is set to 1).

    <CalloutContainer type="info">
      <CalloutDescription>
        The nickname can be different from the nickname in user attributes. However, Agora recommends that you use the same nickname for both. Therefore, if either nickname is updated, the other should be changed at the same time. To update the nickname in user attributes, see [User attributes management](../user-attributes-management).
      </CalloutDescription>
    </CalloutContainer>

    ### HTTP response [#http-response]

    #### Response body [#response-body]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter   | Type   | Description                                                                                                                                                                                                            |
    | :---------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `uuid`      | String | A unique internal identifier generated by the Chat service for the user in this request.                                                                                                                               |
    | `type`      | String | The type of the chat. "user" indicates a One-to-one chat.                                                                                                                                                              |
    | `created`   | Number | The Unix timestamp (ms) when the user account is registered.                                                                                                                                                           |
    | `modified`  | Number | The Unix timestamp (ms) when the user information is last modified.                                                                                                                                                    |
    | `username`  | String | The ID of the user.                                                                                                                                                                                                    |
    | `activated` | Bool   | Whether the user account is active: `true`: The user account is active. `false`: The user account is deactivated. To unban a deactivated user account, refer to [Unbanning a user](../user-system-registration#unban). |
    | `nickname`  | String | The nickname displayed in push notifications.                                                                                                                                                                          |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example]

    #### Request example [#request-example]

    ```bash
    curl -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer ' -d '{ "nickname": "testuser" }' 'http://XXXX/app-id/XXXX/users/user1'
    ```

    #### Response example [#response-example]

    ```json
    {
      "action": "put",
      "application": "8be024f0-XXXX-XXXX-b697-5d598d5f8402",
      "path": "/users",
      "uri": "https://XXXX/app-id/XXXX/users",
      "entities": [
        {
          "uuid": "4759aa70-XXXX-XXXX-925f-6fa0510823ba",
          "type": "user",
          "created": 1542595573399,
          "modified": 1542596083687,
          "username": "user1",
          "activated": true,
          "nickname": "testuser"
          }  ],
    "timestamp": 1542596083685,
    "duration": 6,
    "organization": "agora-demo",
    "applicationName": "testapp"
    }
    ```

    ## Set the display style in push notifications [#set-the-display-style-in-push-notifications]

    Sets the display style of push notifications.

    For each App Key, the total call frequency limit of this method and the method to set the display name is 100 per second.

    ### HTTP request [#http-request-1]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}
    ```

    #### Path parameter [#path-parameter-1]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-1]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-1]

    | Parameter                    | Type | Description                                                                                                                                                                                                                                                                                     | Required |
    | :--------------------------- | :--- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `notification_display_style` | Int  | The display style of push notifications: (Default) `0`: The push title is "You have a new message", and the push content is "Click to check". `1`: The push title is "You have a new message", and the push content contains the nickname of the sender and the content of the offline message. | Yes      |

    ### HTTP response [#http-response-1]

    #### Response body [#response-body-1]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter                    | Type   | Description                                                                                                                                                                                                            |
    | :--------------------------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `uuid`                       | String | A unique internal identifier generated by the Chat service for the user in this request.                                                                                                                               |
    | `type`                       | String | The type of the chat. "user" indicates a One-to-one chat.                                                                                                                                                              |
    | `created`                    | Number | The Unix timestamp (ms) when the user account is registered.                                                                                                                                                           |
    | `modified`                   | Number | The Unix timestamp (ms) when the user information is last modified.                                                                                                                                                    |
    | `username`                   | String | The ID of the user.                                                                                                                                                                                                    |
    | `activated`                  | Bool   | Whether the user account is active: `true`: The user account is active. `false`: The user account is deactivated. To unban a deactivated user account, refer to [Unbanning a user](../user-system-registration#unban). |
    | `notification_display_style` | Int    | The display style of push notifications. This parameter is returned only if you specify it when sending the request.                                                                                                   |
    | `nickname`                   | String | The nickname displayed in push notifications.                                                                                                                                                                          |
    | `notifier_name`              | String | The name of the push certificate.                                                                                                                                                                                      |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-1]

    #### Request example [#request-example-1]

    ```bash
    curl -X PUT -H "Authorization: Bearer " -i https://XXXX/app-id/XXXX/users/a -d '{"notification_display_style": "1"}'
    ```

    #### Response example [#response-example-1]

    ```json
    {
      "action" : "put",
      "application" : "17d59e50-XXXX-XXXX-8092-0dc80c0f5e99",
      "path" : "/users",
      "uri" : "https://XXXX/app-id/XXXX/users/XXXX",
      "entities" : [
        {
          "uuid" : "3b8c9890-XXXX-XXXX-9d88-f50bf55cafad",
          "type" : "user",
          "created" : 1530276298905,
          "modified" : 1534407146060,
          "username" : "user1",
          "activated" : true,
          "notification_display_style" : 1,
          "nickname" : "testuser",
          "notifier_name" : "2882303761517426801"
          } ],
    "timestamp" : 1534407146058,
    "duration" : 3,
    "organization" : "XXXX",
    "applicationName" : "XXXX"
    }
    ```

    ## Set up push notifications [#set-up-push-notifications]

    Sets the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-2]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}/notification/{chattype}/{key}
    ```

    #### Path parameter [#path-parameter-2]

    | Parameter  | Type   | Description                                                                                                                                                                      | Required |
    | :--------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `chattype` | String | The type of the chat: `user`: One-to-one chats. `chatgroup`: Group chats.                                                                                                        | Yes      |
    | `key`      | String | The identifier of the chat: If `type` is set to `user`, `key` indicates the user ID of the peer user. If `type` is set to `chatgroup`, `key` indicates the ID of the chat group. | Yes      |

    <CalloutContainer type="info">
      <CalloutDescription>
        To set up push notifications at the app level, you can set `type` to `user` and `key` to the user ID of the current user.
      </CalloutDescription>
    </CalloutContainer>

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-2]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-2]

    | Parameter        | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Required |
    | :--------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `type`           | String | The push notification mode: `DEFAULT`: A specific conversation uses the setting at the app level. This parameter is valid only for one-to-one and group chat conversations, but not for the app level. `ALL`: Receives push notifications for all offline messages. `AT`: Only receives push notifications for mentioned messages. `NONE`: Do not receive push notifications for offline messages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | No       |
    | `ignoreInterval` | String | The interval during which the DND mode is scheduled everyday. The value is in the format of `{HH:MM-HH:MM}`, for example, 08:30-10:00, where HH ranges from `00` to `23` in hour and MM from `00` to `59` in minute. This parameter works only when `chattype` is set to `user` and `key` to the current user ID in the request header, meaning that the DND interval is valid only for the entire app rather than specific one-to-one or group chat conversations. The DND mode is enabled everyday in the specified interval. For example, if you set this parameter to 08:00-10:00, the app stays in DND mode during 8:00-10:00; if you set the same period at 9:00, the DND mode works during 9:00-10:00 on the current day and 8:00-10:00 in later days. If the start time is set to the same time spot as the end time, like 00:00-00:00, the app enters the permanent DND mode. If the start time is later than the end time, the app remains in DND mode from the start time on the current day until the end time next day. For example, if you set 10:00-08:00, the DND mode lasts from 10:00 until 08:00 the next day.  Currently, only one DND interval is allowed, with the new setting overwriting the old. If this parameter is not specified, pass in an empty string. If both `ignoreInterval` and `ignoreDuration` are set, the DND mode works in both periods. For example, at 8:00, you set `ignoreInterval` to 8:00-10:00 and `ignoreDuration` to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days. | No       |
    | `ignoreDuration` | Number | The DND duration in milliseconds. The value range is \[0,604800000], where `0` indicates that this parameter is invalid and `604800000` indicates that the DND mode lasts for 7 days. This parameter works for both the app and one-to-one and group chat conversations in it.  Unlike `ignoreInterval` set as a daily period, this parameter specifies that the DND mode works only for the given duration starting from the current time. For example, if this parameter is set to 14400000 (4 hours) for the app at 8:00, the DND mode lasts only during 8:00-12:00 on the current day. If both `ignoreInterval` and `ignoreDuration` are set, the DND mode remains in both periods. For example, at 8:00, you set `ignoreInterval` to 8:00-10:00 and `ignoreDuration` to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | No       |

    <CalloutContainer type="info">
      <CalloutDescription>
        For both the app and all the conversations in the app, the DNS mode setting (`ignoreInterval` or `ignoreDuration`) takes precedence over the setting of the push notification mode (`type`). For example, assume that `ignoreInterval` or `ignoreDuration` is specified at the app level and `type` is set to `ALL` for a specific conversation. The app enters the DND mode during the designated period and you do not receive any push notifications during the period.
      </CalloutDescription>
    </CalloutContainer>

    ### HTTP response [#http-response-2]

    #### Response body [#response-body-2]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter        | Type   | Description                 |
    | :--------------- | :----- | :-------------------------- |
    | `type`           | String | The push notification mode. |
    | `ignoreInterval` | String | The DND time frame.         |
    | `ignoreDuration` | Long   | The DND duration.           |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-2]

    #### Request example [#request-example-2]

    ```bash
    curl -L -X PUT 'http://XXXX/app-id/XXXX/users/{username}/notification/user/{key}' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "type":"NONE",
        "ignoreInterval":"21:30-08:00",
        "ignoreDuration":86400000
    }'
    ```

    #### Response example [#response-example-2]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/user/hxtest",
        "timestamp": 1647503749918,
        "organization": "XXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "type": "NONE",
            "ignoreDuration": 1647590149924,
            "ignoreInterval": "21:30-08:00"
        },
        "duration": 20,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve the settings of push notifications [#retrieve-the-settings-of-push-notifications]

    Retrieves the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-3]

    ```html
    GET https://{host}/app-id/{app_id}/users/{username}/notification/{chattype}/{key}
    ```

    #### Path parameter [#path-parameter-3]

    | Parameter  | Type   | Description                                                                                                                                                                      | Required |
    | :--------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `chattype` | String | The type of the chat: `user`: One-to-one chats. `chatgroup`: Group chats.                                                                                                        | Yes      |
    | `key`      | String | The identifier of the chat: If `type` is set to `user`, `key` indicates the user ID of the peer user. If `type` is set to `chatgroup`, `key` indicates the ID of the chat group. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-3]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-3]

    #### Response body [#response-body-3]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter        | Type   | Description                 |
    | :--------------- | :----- | :-------------------------- |
    | `type`           | String | The push notification mode. |
    | `ignoreInterval` | String | The DND time frame.         |
    | `ignoreDuration` | Long   | The DND duration.           |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-3]

    #### Request example [#request-example-3]

    ```bash
    curl -L -X GET 'https://XXXX/app-id/XXXX/users/{username}/notification/chatgroup/{key}' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-3]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/chatgroup/12312312321",
        "timestamp": 1647503749918,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "get",
        "data": {
            "type": "NONE",
            "ignoreDuration": 1647590149924,
            "ignoreInterval": "21:30-08:00"
        },
        "duration": 20,
        "applicationName": "XXXX"
    }
    ```

    ## Set the preferred language of push notifications [#set-the-preferred-language-of-push-notifications]

    Sets the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-4]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}/notification/language
    ```

    #### Path parameter [#path-parameter-4]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-4]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-3]

    | Parameter             | Type   | Description                                                                                                                                                                     | Required |
    | :-------------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `translationLanguage` | String | The code for the language that the user prefers to see push notifications in. If set to an empty string, the server pushes the notifications of the original language directly. | Yes      |

    ### HTTP response [#http-response-4]

    #### Response body [#response-body-4]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter  | Type   | Description                                                                   |
    | :--------- | :----- | :---------------------------------------------------------------------------- |
    | `language` | String | The code for the language that the user prefers to see push notifications in. |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-4]

    #### Request example [#request-example-4]

    ```bash
    curl -L -X PUT 'https://XXXX/app-id/XXXX/users/{username}/notification/language' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "translationLanguage":"EU"
    }'
    ```

    #### Response example [#response-example-4]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/XXXX/notification/language",
        "timestamp": 1648089630244,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "language": "EU"
        },
        "duration": 66,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve the preferred language of push notifications [#retrieve-the-preferred-language-of-push-notifications]

    Retrieves the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-5]

    ```html
    GET https://{host}/app-id/{app_id}/users/{username}/notification/language
    ```

    #### Path parameter [#path-parameter-5]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-5]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-5]

    #### Response body [#response-body-5]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter  | Type   | Description                                                                   |
    | :--------- | :----- | :---------------------------------------------------------------------------- |
    | `language` | String | The code for the language that the user prefers to see push notifications in. |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-5]

    #### Request example [#request-example-5]

    ```bash
    curl -L -X GET 'https://XXXX/app-id/XXXX/users/{username}/notification/language' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-5]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/language",
        "timestamp": 1648089630244,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "language": "EU"
        },
        "duration": 66,
        "applicationName": "XXXX"
    }
    ```

    <a id="create-a-push-template" />

    ## Create a push template [#create-a-push-template]

    Creates a template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-6]

    ```html
    POST https://{host}/app-id/{app_id}/notification/template`
    ```

    For filling of template parameters, `title_args` and `content_args`, see the request body.

    #### Path parameter [#path-parameter-6]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-6]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-4]

    | Parameter         | Type   | Description                                                                                         | Required |
    | :---------------- | :----- | :-------------------------------------------------------------------------------------------------- | -------- |
    | `name`            | String | The name of the push template.                                                                      | Yes      |
    | `title_pattern`   | String | The custom title of the push template. You can add variables in the title, such as {0}.             | Yes      |
    | `content_pattern` | String | The custom content of the push template. You can add variables in the content, such as {0} and {1}. | Yes      |

    ### HTTP response [#http-response-6]

    #### Response body [#response-body-6]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-6]

    #### Request example [#request-example-6]

    ```bash
    curl -X POST 'https://XXXX/app-id/XXXX/notification/template' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "name": "test7",
        "title_pattern": "Hello,{0}",
        "content_pattern": "Test,{0}"
    }'
    ```

    #### Response example [#response-example-6]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template",
        "timestamp": 1646989584108,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "post",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 26,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve a push template [#retrieve-a-push-template]

    Retrieves the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-7]

    ```
    GET https://{host}/app-id/{app_id}/notification/template/{name}
    ```

    #### Path parameter [#path-parameter-7]

    | Parameter | Type   | Description                    | Required |
    | :-------- | :----- | :----------------------------- | -------- |
    | `name`    | String | The name of the push template. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-7]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-7]

    #### Response body [#response-body-7]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-7]

    #### Request example [#request-example-7]

    ```bash
    curl -X GET 'https://XXXX/app-id/XXXX/notification/template/{name}' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-7]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template/test7",
        "timestamp": 1646989686393,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "get",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 11,
        "applicationName": "XXXX"
    }
    ```

    ## Delete a push template [#delete-a-push-template]

    Deletes the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-8]

    ```html
    DELETE https://{host}/app-id/{app_id}/notification/template/{name}
    ```

    #### Path parameter [#path-parameter-8]

    | Parameter | Type   | Description                    | Required |
    | :-------- | :----- | :----------------------------- | -------- |
    | `name`    | String | The name of the push template. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-8]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-8]

    #### Response body [#response-body-8]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-8]

    #### Request example [#request-example-8]

    ```bash
    curl -X DELETE 'https://XXXX/app-id/XXXX/notification/template' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-8]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template",
        "timestamp": 1646989686393,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "delete",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 11,
        "applicationName": "XXXX"
    }
    ```

    ## Status codes [#status-codes]

    For details, see [HTTP Status Codes](../http-status-codes).

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="ios">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="ios" />

    This page shows how to call Chat RESTful APIs to set the display name, display style, push notification mode, and do-not-disturb (DND) mode.

    Before calling the following methods, ensure that you meet the following:

    * You understand the call frequency limit of the Chat RESTful APIs as described in [Limitations](../limitations#call-limit-of-server-sides).

    * You have activated the advanced features for push in [Agora Console](https://console.agora.io/v2). Advanced features allow you to set the push notification mode, do-not-disturb mode, and custom push template.

    <CalloutContainer type="info">
      <CalloutDescription>
        You must contact [support@agora.io](mailto\:support@agora.io) to disable the advanced features for push as this operation will delete all the relevant configurations.
      </CalloutDescription>
    </CalloutContainer>

    ## Common parameters [#common-parameters-1]

    The following table lists common request and response parameters of the Chat RESTful APIs:

    ### Request parameters [#request-parameters-1]

    | Parameter  | Type   | Description                                                                                                                                                                                                                             | Required |
    | :--------- | :----- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
    | `host`     | String | The domain name assigned by the Chat service to access RESTful APIs. For how to get the domain name, see [Get the information of your project](/en/realtime-media/im/get-started/enable#get-the-information-of-the-agora-chat-project). | Yes      |
    | `app_id`   | String | The unique identifier automatically assigned to each project by Agora                                                                                                                                                                   | Yes      |
    | `username` | String | The unique login account of the user.                                                                                                                                                                                                   | Yes      |

    ### Response parameters [#response-parameters-1]

    | Parameter         | Type   | Description                                                                                          |
    | :---------------- | :----- | :--------------------------------------------------------------------------------------------------- |
    | `action`          | String | The request method.                                                                                  |
    | `organization`    | String | The unique identifier assigned to each company (organization) by the Chat service.                   |
    | `application`     | String | A unique internal ID assigned to each app by the Chat service. You can safely ignore this parameter. |
    | `applicationName` | String | The unique identifier assigned to each app by the Chat service .                                     |
    | `timestamp`       | Number | The Unix timestamp (ms) of the HTTP response.                                                        |
    | `duration`        | Number | The duration (ms) from when the HTTP request is sent to the time the response is received.           |
    | `path`            | String | The request path, which is part of the request URL. You can safely ignore this parameter.            |
    | `uri`             | String | The request URI.                                                                                     |
    | `entities `       | JSON   | The response entity.                                                                                 |
    | `data`            | JSON   | The response details.                                                                                |

    ## Authorization [#authorization-1]

    Chat RESTful APIs require Bearer HTTP authentication. Every time an HTTP request is sent, the following `Authorization` field must be filled in the request header:

    ```html
    Authorization: Bearer ${YourAppToken}
    ```

    In order to improve the security of the project, Agora uses a token (dynamic key) to authenticate users before they log in to the chat system. Chat RESTful APIs only support authenticating users using app tokens. For details, see [Authentication using App Token](/en/realtime-media/im/build/secure-access-and-authentication/authentication).

    ## Set the display name in push notifications [#set-the-display-name-in-push-notifications-1]

    Sets the nickname displayed in push notifications.

    For each App Key, the total call frequency limit of this method and the method to set the display style is 100 per second.

    ### HTTP request [#http-request-9]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{userId}
    ```

    #### Path parameter [#path-parameter-9]

    | Parameter | Type   | Description                      | Required |
    | :-------- | :----- | :------------------------------- | :------- |
    | `userId`  | String | The user ID of the current user. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#param).

    #### Request header [#request-header-9]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Accept`        | String | The parameter type. Set it as `application/json`.                                                                                                                                                       | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-5]

    | Parameter  | Type   | Description                                                                                                                   | Required |
    | :--------- | :----- | :---------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `nickname` | String | The nickname that is displayed in the push notification bar of the recipient's client when a message from the user is pushed. | No       |

    The length of `nickname` cannot exceed 100 characters. It supports the following character sets:

    * 26 lowercase English letters (a-z)
    * 26 uppercase English letters (A-Z)
    * 10 numbers (0-9)
    * Chinese characters
    * Special characters

    If no nickname is set, when a message from this user is pushed, the user ID of the message sender, instead of the nickname, is indicated in the notification details (`notification_display_style` is set to 1).

    <CalloutContainer type="info">
      <CalloutDescription>
        The nickname can be different from the nickname in user attributes. However, Agora recommends that you use the same nickname for both. Therefore, if either nickname is updated, the other should be changed at the same time. To update the nickname in user attributes, see [User attributes management](../user-attributes-management).
      </CalloutDescription>
    </CalloutContainer>

    ### HTTP response [#http-response-9]

    #### Response body [#response-body-9]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter   | Type   | Description                                                                                                                                                                                                            |
    | :---------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `uuid`      | String | A unique internal identifier generated by the Chat service for the user in this request.                                                                                                                               |
    | `type`      | String | The type of the chat. "user" indicates a One-to-one chat.                                                                                                                                                              |
    | `created`   | Number | The Unix timestamp (ms) when the user account is registered.                                                                                                                                                           |
    | `modified`  | Number | The Unix timestamp (ms) when the user information is last modified.                                                                                                                                                    |
    | `username`  | String | The ID of the user.                                                                                                                                                                                                    |
    | `activated` | Bool   | Whether the user account is active: `true`: The user account is active. `false`: The user account is deactivated. To unban a deactivated user account, refer to [Unbanning a user](../user-system-registration#unban). |
    | `nickname`  | String | The nickname displayed in push notifications.                                                                                                                                                                          |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-9]

    #### Request example [#request-example-9]

    ```bash
    curl -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer ' -d '{ "nickname": "testuser" }' 'http://XXXX/app-id/XXXX/users/user1'
    ```

    #### Response example [#response-example-9]

    ```json
    {
      "action": "put",
      "application": "8be024f0-XXXX-XXXX-b697-5d598d5f8402",
      "path": "/users",
      "uri": "https://XXXX/app-id/XXXX/users",
      "entities": [
        {
          "uuid": "4759aa70-XXXX-XXXX-925f-6fa0510823ba",
          "type": "user",
          "created": 1542595573399,
          "modified": 1542596083687,
          "username": "user1",
          "activated": true,
          "nickname": "testuser"
          }  ],
    "timestamp": 1542596083685,
    "duration": 6,
    "organization": "agora-demo",
    "applicationName": "testapp"
    }
    ```

    ## Set the display style in push notifications [#set-the-display-style-in-push-notifications-1]

    Sets the display style of push notifications.

    For each App Key, the total call frequency limit of this method and the method to set the display name is 100 per second.

    ### HTTP request [#http-request-10]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}
    ```

    #### Path parameter [#path-parameter-10]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-10]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-6]

    | Parameter                    | Type | Description                                                                                                                                                                                                                                                                                     | Required |
    | :--------------------------- | :--- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `notification_display_style` | Int  | The display style of push notifications: (Default) `0`: The push title is "You have a new message", and the push content is "Click to check". `1`: The push title is "You have a new message", and the push content contains the nickname of the sender and the content of the offline message. | Yes      |

    ### HTTP response [#http-response-10]

    #### Response body [#response-body-10]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter                    | Type   | Description                                                                                                                                                                                                            |
    | :--------------------------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `uuid`                       | String | A unique internal identifier generated by the Chat service for the user in this request.                                                                                                                               |
    | `type`                       | String | The type of the chat. "user" indicates a One-to-one chat.                                                                                                                                                              |
    | `created`                    | Number | The Unix timestamp (ms) when the user account is registered.                                                                                                                                                           |
    | `modified`                   | Number | The Unix timestamp (ms) when the user information is last modified.                                                                                                                                                    |
    | `username`                   | String | The ID of the user.                                                                                                                                                                                                    |
    | `activated`                  | Bool   | Whether the user account is active: `true`: The user account is active. `false`: The user account is deactivated. To unban a deactivated user account, refer to [Unbanning a user](../user-system-registration#unban). |
    | `notification_display_style` | Int    | The display style of push notifications. This parameter is returned only if you specify it when sending the request.                                                                                                   |
    | `nickname`                   | String | The nickname displayed in push notifications.                                                                                                                                                                          |
    | `notifier_name`              | String | The name of the push certificate.                                                                                                                                                                                      |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-10]

    #### Request example [#request-example-10]

    ```bash
    curl -X PUT -H "Authorization: Bearer " -i https://XXXX/app-id/XXXX/users/a -d '{"notification_display_style": "1"}'
    ```

    #### Response example [#response-example-10]

    ```json
    {
      "action" : "put",
      "application" : "17d59e50-XXXX-XXXX-8092-0dc80c0f5e99",
      "path" : "/users",
      "uri" : "https://XXXX/app-id/XXXX/users/XXXX",
      "entities" : [
        {
          "uuid" : "3b8c9890-XXXX-XXXX-9d88-f50bf55cafad",
          "type" : "user",
          "created" : 1530276298905,
          "modified" : 1534407146060,
          "username" : "user1",
          "activated" : true,
          "notification_display_style" : 1,
          "nickname" : "testuser",
          "notifier_name" : "2882303761517426801"
          } ],
    "timestamp" : 1534407146058,
    "duration" : 3,
    "organization" : "XXXX",
    "applicationName" : "XXXX"
    }
    ```

    ## Set up push notifications [#set-up-push-notifications-1]

    Sets the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-11]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}/notification/{chattype}/{key}
    ```

    #### Path parameter [#path-parameter-11]

    | Parameter  | Type   | Description                                                                                                                                                                      | Required |
    | :--------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `chattype` | String | The type of the chat: `user`: One-to-one chats. `chatgroup`: Group chats.                                                                                                        | Yes      |
    | `key`      | String | The identifier of the chat: If `type` is set to `user`, `key` indicates the user ID of the peer user. If `type` is set to `chatgroup`, `key` indicates the ID of the chat group. | Yes      |

    <CalloutContainer type="info">
      <CalloutDescription>
        To set up push notifications at the app level, you can set `type` to `user` and `key` to the user ID of the current user.
      </CalloutDescription>
    </CalloutContainer>

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-11]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-7]

    | Parameter        | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Required |
    | :--------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `type`           | String | The push notification mode: `DEFAULT`: A specific conversation uses the setting at the app level. This parameter is valid only for one-to-one and group chat conversations, but not for the app level. `ALL`: Receives push notifications for all offline messages. `AT`: Only receives push notifications for mentioned messages. `NONE`: Do not receive push notifications for offline messages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | No       |
    | `ignoreInterval` | String | The interval during which the DND mode is scheduled everyday. The value is in the format of `{HH:MM-HH:MM}`, for example, 08:30-10:00, where HH ranges from `00` to `23` in hour and MM from `00` to `59` in minute. This parameter works only when `chattype` is set to `user` and `key` to the current user ID in the request header, meaning that the DND interval is valid only for the entire app rather than specific one-to-one or group chat conversations. The DND mode is enabled everyday in the specified interval. For example, if you set this parameter to 08:00-10:00, the app stays in DND mode during 8:00-10:00; if you set the same period at 9:00, the DND mode works during 9:00-10:00 on the current day and 8:00-10:00 in later days. If the start time is set to the same time spot as the end time, like 00:00-00:00, the app enters the permanent DND mode. If the start time is later than the end time, the app remains in DND mode from the start time on the current day until the end time next day. For example, if you set 10:00-08:00, the DND mode lasts from 10:00 until 08:00 the next day.  Currently, only one DND interval is allowed, with the new setting overwriting the old. If this parameter is not specified, pass in an empty string. If both `ignoreInterval` and `ignoreDuration` are set, the DND mode works in both periods. For example, at 8:00, you set `ignoreInterval` to 8:00-10:00 and `ignoreDuration` to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days. | No       |
    | `ignoreDuration` | Number | The DND duration in milliseconds. The value range is \[0,604800000], where `0` indicates that this parameter is invalid and `604800000` indicates that the DND mode lasts for 7 days. This parameter works for both the app and one-to-one and group chat conversations in it.  Unlike `ignoreInterval` set as a daily period, this parameter specifies that the DND mode works only for the given duration starting from the current time. For example, if this parameter is set to 14400000 (4 hours) for the app at 8:00, the DND mode lasts only during 8:00-12:00 on the current day. If both `ignoreInterval` and `ignoreDuration` are set, the DND mode remains in both periods. For example, at 8:00, you set `ignoreInterval` to 8:00-10:00 and `ignoreDuration` to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | No       |

    <CalloutContainer type="info">
      <CalloutDescription>
        For both the app and all the conversations in the app, the DNS mode setting (`ignoreInterval` or `ignoreDuration`) takes precedence over the setting of the push notification mode (`type`). For example, assume that `ignoreInterval` or `ignoreDuration` is specified at the app level and `type` is set to `ALL` for a specific conversation. The app enters the DND mode during the designated period and you do not receive any push notifications during the period.
      </CalloutDescription>
    </CalloutContainer>

    ### HTTP response [#http-response-11]

    #### Response body [#response-body-11]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter        | Type   | Description                 |
    | :--------------- | :----- | :-------------------------- |
    | `type`           | String | The push notification mode. |
    | `ignoreInterval` | String | The DND time frame.         |
    | `ignoreDuration` | Long   | The DND duration.           |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-11]

    #### Request example [#request-example-11]

    ```bash
    curl -L -X PUT 'http://XXXX/app-id/XXXX/users/{username}/notification/user/{key}' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "type":"NONE",
        "ignoreInterval":"21:30-08:00",
        "ignoreDuration":86400000
    }'
    ```

    #### Response example [#response-example-11]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/user/hxtest",
        "timestamp": 1647503749918,
        "organization": "XXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "type": "NONE",
            "ignoreDuration": 1647590149924,
            "ignoreInterval": "21:30-08:00"
        },
        "duration": 20,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve the settings of push notifications [#retrieve-the-settings-of-push-notifications-1]

    Retrieves the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-12]

    ```html
    GET https://{host}/app-id/{app_id}/users/{username}/notification/{chattype}/{key}
    ```

    #### Path parameter [#path-parameter-12]

    | Parameter  | Type   | Description                                                                                                                                                                      | Required |
    | :--------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `chattype` | String | The type of the chat: `user`: One-to-one chats. `chatgroup`: Group chats.                                                                                                        | Yes      |
    | `key`      | String | The identifier of the chat: If `type` is set to `user`, `key` indicates the user ID of the peer user. If `type` is set to `chatgroup`, `key` indicates the ID of the chat group. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-12]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-12]

    #### Response body [#response-body-12]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter        | Type   | Description                 |
    | :--------------- | :----- | :-------------------------- |
    | `type`           | String | The push notification mode. |
    | `ignoreInterval` | String | The DND time frame.         |
    | `ignoreDuration` | Long   | The DND duration.           |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-12]

    #### Request example [#request-example-12]

    ```bash
    curl -L -X GET 'https://XXXX/app-id/XXXX/users/{username}/notification/chatgroup/{key}' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-12]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/chatgroup/12312312321",
        "timestamp": 1647503749918,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "get",
        "data": {
            "type": "NONE",
            "ignoreDuration": 1647590149924,
            "ignoreInterval": "21:30-08:00"
        },
        "duration": 20,
        "applicationName": "XXXX"
    }
    ```

    ## Set the preferred language of push notifications [#set-the-preferred-language-of-push-notifications-1]

    Sets the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-13]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}/notification/language
    ```

    #### Path parameter [#path-parameter-13]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-13]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-8]

    | Parameter             | Type   | Description                                                                                                                                                                     | Required |
    | :-------------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `translationLanguage` | String | The code for the language that the user prefers to see push notifications in. If set to an empty string, the server pushes the notifications of the original language directly. | Yes      |

    ### HTTP response [#http-response-13]

    #### Response body [#response-body-13]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter  | Type   | Description                                                                   |
    | :--------- | :----- | :---------------------------------------------------------------------------- |
    | `language` | String | The code for the language that the user prefers to see push notifications in. |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-13]

    #### Request example [#request-example-13]

    ```bash
    curl -L -X PUT 'https://XXXX/app-id/XXXX/users/{username}/notification/language' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "translationLanguage":"EU"
    }'
    ```

    #### Response example [#response-example-13]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/XXXX/notification/language",
        "timestamp": 1648089630244,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "language": "EU"
        },
        "duration": 66,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve the preferred language of push notifications [#retrieve-the-preferred-language-of-push-notifications-1]

    Retrieves the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-14]

    ```html
    GET https://{host}/app-id/{app_id}/users/{username}/notification/language
    ```

    #### Path parameter [#path-parameter-14]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-14]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-14]

    #### Response body [#response-body-14]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter  | Type   | Description                                                                   |
    | :--------- | :----- | :---------------------------------------------------------------------------- |
    | `language` | String | The code for the language that the user prefers to see push notifications in. |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-14]

    #### Request example [#request-example-14]

    ```bash
    curl -L -X GET 'https://XXXX/app-id/XXXX/users/{username}/notification/language' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-14]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/language",
        "timestamp": 1648089630244,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "language": "EU"
        },
        "duration": 66,
        "applicationName": "XXXX"
    }
    ```

    <a id="create-a-push-template" />

    ## Create a push template [#create-a-push-template-1]

    Creates a template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-15]

    ```html
    POST https://{host}/app-id/{app_id}/notification/template`
    ```

    For filling of template parameters, `title_args` and `content_args`, see the request body.

    #### Path parameter [#path-parameter-15]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-15]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-9]

    | Parameter         | Type   | Description                                                                                         | Required |
    | :---------------- | :----- | :-------------------------------------------------------------------------------------------------- | -------- |
    | `name`            | String | The name of the push template.                                                                      | Yes      |
    | `title_pattern`   | String | The custom title of the push template. You can add variables in the title, such as {0}.             | Yes      |
    | `content_pattern` | String | The custom content of the push template. You can add variables in the content, such as {0} and {1}. | Yes      |

    ### HTTP response [#http-response-15]

    #### Response body [#response-body-15]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-15]

    #### Request example [#request-example-15]

    ```bash
    curl -X POST 'https://XXXX/app-id/XXXX/notification/template' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "name": "test7",
        "title_pattern": "Hello,{0}",
        "content_pattern": "Test,{0}"
    }'
    ```

    #### Response example [#response-example-15]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template",
        "timestamp": 1646989584108,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "post",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 26,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve a push template [#retrieve-a-push-template-1]

    Retrieves the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-16]

    ```
    GET https://{host}/app-id/{app_id}/notification/template/{name}
    ```

    #### Path parameter [#path-parameter-16]

    | Parameter | Type   | Description                    | Required |
    | :-------- | :----- | :----------------------------- | -------- |
    | `name`    | String | The name of the push template. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-16]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-16]

    #### Response body [#response-body-16]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-16]

    #### Request example [#request-example-16]

    ```bash
    curl -X GET 'https://XXXX/app-id/XXXX/notification/template/{name}' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-16]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template/test7",
        "timestamp": 1646989686393,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "get",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 11,
        "applicationName": "XXXX"
    }
    ```

    ## Delete a push template [#delete-a-push-template-1]

    Deletes the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-17]

    ```html
    DELETE https://{host}/app-id/{app_id}/notification/template/{name}
    ```

    #### Path parameter [#path-parameter-17]

    | Parameter | Type   | Description                    | Required |
    | :-------- | :----- | :----------------------------- | -------- |
    | `name`    | String | The name of the push template. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-17]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-17]

    #### Response body [#response-body-17]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-17]

    #### Request example [#request-example-17]

    ```bash
    curl -X DELETE 'https://XXXX/app-id/XXXX/notification/template' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-17]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template",
        "timestamp": 1646989686393,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "delete",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 11,
        "applicationName": "XXXX"
    }
    ```

    ## Status codes [#status-codes-1]

    For details, see [HTTP Status Codes](../http-status-codes).

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="flutter">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="flutter" />

    This page shows how to call Chat RESTful APIs to set the display name, display style, push notification mode, and do-not-disturb (DND) mode.

    Before calling the following methods, ensure that you meet the following:

    * You understand the call frequency limit of the Chat RESTful APIs as described in [Limitations](../limitations#call-limit-of-server-sides).

    * You have activated the advanced features for push in [Agora Console](https://console.agora.io/v2). Advanced features allow you to set the push notification mode, do-not-disturb mode, and custom push template.

    <CalloutContainer type="info">
      <CalloutDescription>
        You must contact [support@agora.io](mailto\:support@agora.io) to disable the advanced features for push as this operation will delete all the relevant configurations.
      </CalloutDescription>
    </CalloutContainer>

    ## Common parameters [#common-parameters-2]

    The following table lists common request and response parameters of the Chat RESTful APIs:

    ### Request parameters [#request-parameters-2]

    | Parameter  | Type   | Description                                                                                                                                                                                                                             | Required |
    | :--------- | :----- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
    | `host`     | String | The domain name assigned by the Chat service to access RESTful APIs. For how to get the domain name, see [Get the information of your project](/en/realtime-media/im/get-started/enable#get-the-information-of-the-agora-chat-project). | Yes      |
    | `app_id`   | String | The unique identifier automatically assigned to each project by Agora                                                                                                                                                                   | Yes      |
    | `username` | String | The unique login account of the user.                                                                                                                                                                                                   | Yes      |

    ### Response parameters [#response-parameters-2]

    | Parameter         | Type   | Description                                                                                          |
    | :---------------- | :----- | :--------------------------------------------------------------------------------------------------- |
    | `action`          | String | The request method.                                                                                  |
    | `organization`    | String | The unique identifier assigned to each company (organization) by the Chat service.                   |
    | `application`     | String | A unique internal ID assigned to each app by the Chat service. You can safely ignore this parameter. |
    | `applicationName` | String | The unique identifier assigned to each app by the Chat service .                                     |
    | `timestamp`       | Number | The Unix timestamp (ms) of the HTTP response.                                                        |
    | `duration`        | Number | The duration (ms) from when the HTTP request is sent to the time the response is received.           |
    | `path`            | String | The request path, which is part of the request URL. You can safely ignore this parameter.            |
    | `uri`             | String | The request URI.                                                                                     |
    | `entities `       | JSON   | The response entity.                                                                                 |
    | `data`            | JSON   | The response details.                                                                                |

    ## Authorization [#authorization-2]

    Chat RESTful APIs require Bearer HTTP authentication. Every time an HTTP request is sent, the following `Authorization` field must be filled in the request header:

    ```html
    Authorization: Bearer ${YourAppToken}
    ```

    In order to improve the security of the project, Agora uses a token (dynamic key) to authenticate users before they log in to the chat system. Chat RESTful APIs only support authenticating users using app tokens. For details, see [Authentication using App Token](/en/realtime-media/im/build/secure-access-and-authentication/authentication).

    ## Set the display name in push notifications [#set-the-display-name-in-push-notifications-2]

    Sets the nickname displayed in push notifications.

    For each App Key, the total call frequency limit of this method and the method to set the display style is 100 per second.

    ### HTTP request [#http-request-18]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{userId}
    ```

    #### Path parameter [#path-parameter-18]

    | Parameter | Type   | Description                      | Required |
    | :-------- | :----- | :------------------------------- | :------- |
    | `userId`  | String | The user ID of the current user. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#param).

    #### Request header [#request-header-18]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Accept`        | String | The parameter type. Set it as `application/json`.                                                                                                                                                       | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-10]

    | Parameter  | Type   | Description                                                                                                                   | Required |
    | :--------- | :----- | :---------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `nickname` | String | The nickname that is displayed in the push notification bar of the recipient's client when a message from the user is pushed. | No       |

    The length of `nickname` cannot exceed 100 characters. It supports the following character sets:

    * 26 lowercase English letters (a-z)
    * 26 uppercase English letters (A-Z)
    * 10 numbers (0-9)
    * Chinese characters
    * Special characters

    If no nickname is set, when a message from this user is pushed, the user ID of the message sender, instead of the nickname, is indicated in the notification details (`notification_display_style` is set to 1).

    <CalloutContainer type="info">
      <CalloutDescription>
        The nickname can be different from the nickname in user attributes. However, Agora recommends that you use the same nickname for both. Therefore, if either nickname is updated, the other should be changed at the same time. To update the nickname in user attributes, see [User attributes management](../user-attributes-management).
      </CalloutDescription>
    </CalloutContainer>

    ### HTTP response [#http-response-18]

    #### Response body [#response-body-18]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter   | Type   | Description                                                                                                                                                                                                            |
    | :---------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `uuid`      | String | A unique internal identifier generated by the Chat service for the user in this request.                                                                                                                               |
    | `type`      | String | The type of the chat. "user" indicates a One-to-one chat.                                                                                                                                                              |
    | `created`   | Number | The Unix timestamp (ms) when the user account is registered.                                                                                                                                                           |
    | `modified`  | Number | The Unix timestamp (ms) when the user information is last modified.                                                                                                                                                    |
    | `username`  | String | The ID of the user.                                                                                                                                                                                                    |
    | `activated` | Bool   | Whether the user account is active: `true`: The user account is active. `false`: The user account is deactivated. To unban a deactivated user account, refer to [Unbanning a user](../user-system-registration#unban). |
    | `nickname`  | String | The nickname displayed in push notifications.                                                                                                                                                                          |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-18]

    #### Request example [#request-example-18]

    ```bash
    curl -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer ' -d '{ "nickname": "testuser" }' 'http://XXXX/app-id/XXXX/users/user1'
    ```

    #### Response example [#response-example-18]

    ```json
    {
      "action": "put",
      "application": "8be024f0-XXXX-XXXX-b697-5d598d5f8402",
      "path": "/users",
      "uri": "https://XXXX/app-id/XXXX/users",
      "entities": [
        {
          "uuid": "4759aa70-XXXX-XXXX-925f-6fa0510823ba",
          "type": "user",
          "created": 1542595573399,
          "modified": 1542596083687,
          "username": "user1",
          "activated": true,
          "nickname": "testuser"
          }  ],
    "timestamp": 1542596083685,
    "duration": 6,
    "organization": "agora-demo",
    "applicationName": "testapp"
    }
    ```

    ## Set the display style in push notifications [#set-the-display-style-in-push-notifications-2]

    Sets the display style of push notifications.

    For each App Key, the total call frequency limit of this method and the method to set the display name is 100 per second.

    ### HTTP request [#http-request-19]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}
    ```

    #### Path parameter [#path-parameter-19]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-19]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-11]

    | Parameter                    | Type | Description                                                                                                                                                                                                                                                                                     | Required |
    | :--------------------------- | :--- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `notification_display_style` | Int  | The display style of push notifications: (Default) `0`: The push title is "You have a new message", and the push content is "Click to check". `1`: The push title is "You have a new message", and the push content contains the nickname of the sender and the content of the offline message. | Yes      |

    ### HTTP response [#http-response-19]

    #### Response body [#response-body-19]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter                    | Type   | Description                                                                                                                                                                                                            |
    | :--------------------------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `uuid`                       | String | A unique internal identifier generated by the Chat service for the user in this request.                                                                                                                               |
    | `type`                       | String | The type of the chat. "user" indicates a One-to-one chat.                                                                                                                                                              |
    | `created`                    | Number | The Unix timestamp (ms) when the user account is registered.                                                                                                                                                           |
    | `modified`                   | Number | The Unix timestamp (ms) when the user information is last modified.                                                                                                                                                    |
    | `username`                   | String | The ID of the user.                                                                                                                                                                                                    |
    | `activated`                  | Bool   | Whether the user account is active: `true`: The user account is active. `false`: The user account is deactivated. To unban a deactivated user account, refer to [Unbanning a user](../user-system-registration#unban). |
    | `notification_display_style` | Int    | The display style of push notifications. This parameter is returned only if you specify it when sending the request.                                                                                                   |
    | `nickname`                   | String | The nickname displayed in push notifications.                                                                                                                                                                          |
    | `notifier_name`              | String | The name of the push certificate.                                                                                                                                                                                      |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-19]

    #### Request example [#request-example-19]

    ```bash
    curl -X PUT -H "Authorization: Bearer " -i https://XXXX/app-id/XXXX/users/a -d '{"notification_display_style": "1"}'
    ```

    #### Response example [#response-example-19]

    ```json
    {
      "action" : "put",
      "application" : "17d59e50-XXXX-XXXX-8092-0dc80c0f5e99",
      "path" : "/users",
      "uri" : "https://XXXX/app-id/XXXX/users/XXXX",
      "entities" : [
        {
          "uuid" : "3b8c9890-XXXX-XXXX-9d88-f50bf55cafad",
          "type" : "user",
          "created" : 1530276298905,
          "modified" : 1534407146060,
          "username" : "user1",
          "activated" : true,
          "notification_display_style" : 1,
          "nickname" : "testuser",
          "notifier_name" : "2882303761517426801"
          } ],
    "timestamp" : 1534407146058,
    "duration" : 3,
    "organization" : "XXXX",
    "applicationName" : "XXXX"
    }
    ```

    ## Set up push notifications [#set-up-push-notifications-2]

    Sets the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-20]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}/notification/{chattype}/{key}
    ```

    #### Path parameter [#path-parameter-20]

    | Parameter  | Type   | Description                                                                                                                                                                      | Required |
    | :--------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `chattype` | String | The type of the chat: `user`: One-to-one chats. `chatgroup`: Group chats.                                                                                                        | Yes      |
    | `key`      | String | The identifier of the chat: If `type` is set to `user`, `key` indicates the user ID of the peer user. If `type` is set to `chatgroup`, `key` indicates the ID of the chat group. | Yes      |

    <CalloutContainer type="info">
      <CalloutDescription>
        To set up push notifications at the app level, you can set `type` to `user` and `key` to the user ID of the current user.
      </CalloutDescription>
    </CalloutContainer>

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-20]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-12]

    | Parameter        | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Required |
    | :--------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `type`           | String | The push notification mode: `DEFAULT`: A specific conversation uses the setting at the app level. This parameter is valid only for one-to-one and group chat conversations, but not for the app level. `ALL`: Receives push notifications for all offline messages. `AT`: Only receives push notifications for mentioned messages. `NONE`: Do not receive push notifications for offline messages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | No       |
    | `ignoreInterval` | String | The interval during which the DND mode is scheduled everyday. The value is in the format of `{HH:MM-HH:MM}`, for example, 08:30-10:00, where HH ranges from `00` to `23` in hour and MM from `00` to `59` in minute. This parameter works only when `chattype` is set to `user` and `key` to the current user ID in the request header, meaning that the DND interval is valid only for the entire app rather than specific one-to-one or group chat conversations. The DND mode is enabled everyday in the specified interval. For example, if you set this parameter to 08:00-10:00, the app stays in DND mode during 8:00-10:00; if you set the same period at 9:00, the DND mode works during 9:00-10:00 on the current day and 8:00-10:00 in later days. If the start time is set to the same time spot as the end time, like 00:00-00:00, the app enters the permanent DND mode. If the start time is later than the end time, the app remains in DND mode from the start time on the current day until the end time next day. For example, if you set 10:00-08:00, the DND mode lasts from 10:00 until 08:00 the next day.  Currently, only one DND interval is allowed, with the new setting overwriting the old. If this parameter is not specified, pass in an empty string. If both `ignoreInterval` and `ignoreDuration` are set, the DND mode works in both periods. For example, at 8:00, you set `ignoreInterval` to 8:00-10:00 and `ignoreDuration` to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days. | No       |
    | `ignoreDuration` | Number | The DND duration in milliseconds. The value range is \[0,604800000], where `0` indicates that this parameter is invalid and `604800000` indicates that the DND mode lasts for 7 days. This parameter works for both the app and one-to-one and group chat conversations in it.  Unlike `ignoreInterval` set as a daily period, this parameter specifies that the DND mode works only for the given duration starting from the current time. For example, if this parameter is set to 14400000 (4 hours) for the app at 8:00, the DND mode lasts only during 8:00-12:00 on the current day. If both `ignoreInterval` and `ignoreDuration` are set, the DND mode remains in both periods. For example, at 8:00, you set `ignoreInterval` to 8:00-10:00 and `ignoreDuration` to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | No       |

    <CalloutContainer type="info">
      <CalloutDescription>
        For both the app and all the conversations in the app, the DNS mode setting (`ignoreInterval` or `ignoreDuration`) takes precedence over the setting of the push notification mode (`type`). For example, assume that `ignoreInterval` or `ignoreDuration` is specified at the app level and `type` is set to `ALL` for a specific conversation. The app enters the DND mode during the designated period and you do not receive any push notifications during the period.
      </CalloutDescription>
    </CalloutContainer>

    ### HTTP response [#http-response-20]

    #### Response body [#response-body-20]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter        | Type   | Description                 |
    | :--------------- | :----- | :-------------------------- |
    | `type`           | String | The push notification mode. |
    | `ignoreInterval` | String | The DND time frame.         |
    | `ignoreDuration` | Long   | The DND duration.           |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-20]

    #### Request example [#request-example-20]

    ```bash
    curl -L -X PUT 'http://XXXX/app-id/XXXX/users/{username}/notification/user/{key}' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "type":"NONE",
        "ignoreInterval":"21:30-08:00",
        "ignoreDuration":86400000
    }'
    ```

    #### Response example [#response-example-20]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/user/hxtest",
        "timestamp": 1647503749918,
        "organization": "XXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "type": "NONE",
            "ignoreDuration": 1647590149924,
            "ignoreInterval": "21:30-08:00"
        },
        "duration": 20,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve the settings of push notifications [#retrieve-the-settings-of-push-notifications-2]

    Retrieves the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-21]

    ```html
    GET https://{host}/app-id/{app_id}/users/{username}/notification/{chattype}/{key}
    ```

    #### Path parameter [#path-parameter-21]

    | Parameter  | Type   | Description                                                                                                                                                                      | Required |
    | :--------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `chattype` | String | The type of the chat: `user`: One-to-one chats. `chatgroup`: Group chats.                                                                                                        | Yes      |
    | `key`      | String | The identifier of the chat: If `type` is set to `user`, `key` indicates the user ID of the peer user. If `type` is set to `chatgroup`, `key` indicates the ID of the chat group. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-21]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-21]

    #### Response body [#response-body-21]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter        | Type   | Description                 |
    | :--------------- | :----- | :-------------------------- |
    | `type`           | String | The push notification mode. |
    | `ignoreInterval` | String | The DND time frame.         |
    | `ignoreDuration` | Long   | The DND duration.           |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-21]

    #### Request example [#request-example-21]

    ```bash
    curl -L -X GET 'https://XXXX/app-id/XXXX/users/{username}/notification/chatgroup/{key}' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-21]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/chatgroup/12312312321",
        "timestamp": 1647503749918,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "get",
        "data": {
            "type": "NONE",
            "ignoreDuration": 1647590149924,
            "ignoreInterval": "21:30-08:00"
        },
        "duration": 20,
        "applicationName": "XXXX"
    }
    ```

    ## Set the preferred language of push notifications [#set-the-preferred-language-of-push-notifications-2]

    Sets the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-22]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}/notification/language
    ```

    #### Path parameter [#path-parameter-22]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-22]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-13]

    | Parameter             | Type   | Description                                                                                                                                                                     | Required |
    | :-------------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `translationLanguage` | String | The code for the language that the user prefers to see push notifications in. If set to an empty string, the server pushes the notifications of the original language directly. | Yes      |

    ### HTTP response [#http-response-22]

    #### Response body [#response-body-22]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter  | Type   | Description                                                                   |
    | :--------- | :----- | :---------------------------------------------------------------------------- |
    | `language` | String | The code for the language that the user prefers to see push notifications in. |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-22]

    #### Request example [#request-example-22]

    ```bash
    curl -L -X PUT 'https://XXXX/app-id/XXXX/users/{username}/notification/language' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "translationLanguage":"EU"
    }'
    ```

    #### Response example [#response-example-22]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/XXXX/notification/language",
        "timestamp": 1648089630244,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "language": "EU"
        },
        "duration": 66,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve the preferred language of push notifications [#retrieve-the-preferred-language-of-push-notifications-2]

    Retrieves the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-23]

    ```html
    GET https://{host}/app-id/{app_id}/users/{username}/notification/language
    ```

    #### Path parameter [#path-parameter-23]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-23]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-23]

    #### Response body [#response-body-23]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter  | Type   | Description                                                                   |
    | :--------- | :----- | :---------------------------------------------------------------------------- |
    | `language` | String | The code for the language that the user prefers to see push notifications in. |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-23]

    #### Request example [#request-example-23]

    ```bash
    curl -L -X GET 'https://XXXX/app-id/XXXX/users/{username}/notification/language' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-23]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/language",
        "timestamp": 1648089630244,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "language": "EU"
        },
        "duration": 66,
        "applicationName": "XXXX"
    }
    ```

    <a id="create-a-push-template" />

    ## Create a push template [#create-a-push-template-2]

    Creates a template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-24]

    ```html
    POST https://{host}/app-id/{app_id}/notification/template`
    ```

    For filling of template parameters, `title_args` and `content_args`, see the request body.

    #### Path parameter [#path-parameter-24]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-24]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-14]

    | Parameter         | Type   | Description                                                                                         | Required |
    | :---------------- | :----- | :-------------------------------------------------------------------------------------------------- | -------- |
    | `name`            | String | The name of the push template.                                                                      | Yes      |
    | `title_pattern`   | String | The custom title of the push template. You can add variables in the title, such as {0}.             | Yes      |
    | `content_pattern` | String | The custom content of the push template. You can add variables in the content, such as {0} and {1}. | Yes      |

    ### HTTP response [#http-response-24]

    #### Response body [#response-body-24]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-24]

    #### Request example [#request-example-24]

    ```bash
    curl -X POST 'https://XXXX/app-id/XXXX/notification/template' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "name": "test7",
        "title_pattern": "Hello,{0}",
        "content_pattern": "Test,{0}"
    }'
    ```

    #### Response example [#response-example-24]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template",
        "timestamp": 1646989584108,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "post",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 26,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve a push template [#retrieve-a-push-template-2]

    Retrieves the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-25]

    ```
    GET https://{host}/app-id/{app_id}/notification/template/{name}
    ```

    #### Path parameter [#path-parameter-25]

    | Parameter | Type   | Description                    | Required |
    | :-------- | :----- | :----------------------------- | -------- |
    | `name`    | String | The name of the push template. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-25]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-25]

    #### Response body [#response-body-25]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-25]

    #### Request example [#request-example-25]

    ```bash
    curl -X GET 'https://XXXX/app-id/XXXX/notification/template/{name}' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-25]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template/test7",
        "timestamp": 1646989686393,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "get",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 11,
        "applicationName": "XXXX"
    }
    ```

    ## Delete a push template [#delete-a-push-template-2]

    Deletes the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-26]

    ```html
    DELETE https://{host}/app-id/{app_id}/notification/template/{name}
    ```

    #### Path parameter [#path-parameter-26]

    | Parameter | Type   | Description                    | Required |
    | :-------- | :----- | :----------------------------- | -------- |
    | `name`    | String | The name of the push template. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-26]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-26]

    #### Response body [#response-body-26]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-26]

    #### Request example [#request-example-26]

    ```bash
    curl -X DELETE 'https://XXXX/app-id/XXXX/notification/template' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-26]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template",
        "timestamp": 1646989686393,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "delete",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 11,
        "applicationName": "XXXX"
    }
    ```

    ## Status codes [#status-codes-2]

    For details, see [HTTP Status Codes](../http-status-codes).

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="react-native">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="react-native" />

    This page shows how to call Chat RESTful APIs to set the display name, display style, push notification mode, and do-not-disturb (DND) mode.

    Before calling the following methods, ensure that you meet the following:

    * You understand the call frequency limit of the Chat RESTful APIs as described in [Limitations](../limitations#call-limit-of-server-sides).

    * You have activated the advanced features for push in [Agora Console](https://console.agora.io/v2). Advanced features allow you to set the push notification mode, do-not-disturb mode, and custom push template.

    <CalloutContainer type="info">
      <CalloutDescription>
        You must contact [support@agora.io](mailto\:support@agora.io) to disable the advanced features for push as this operation will delete all the relevant configurations.
      </CalloutDescription>
    </CalloutContainer>

    ## Common parameters [#common-parameters-3]

    The following table lists common request and response parameters of the Chat RESTful APIs:

    ### Request parameters [#request-parameters-3]

    | Parameter  | Type   | Description                                                                                                                                                                                                                             | Required |
    | :--------- | :----- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
    | `host`     | String | The domain name assigned by the Chat service to access RESTful APIs. For how to get the domain name, see [Get the information of your project](/en/realtime-media/im/get-started/enable#get-the-information-of-the-agora-chat-project). | Yes      |
    | `app_id`   | String | The unique identifier automatically assigned to each project by Agora                                                                                                                                                                   | Yes      |
    | `username` | String | The unique login account of the user.                                                                                                                                                                                                   | Yes      |

    ### Response parameters [#response-parameters-3]

    | Parameter         | Type   | Description                                                                                          |
    | :---------------- | :----- | :--------------------------------------------------------------------------------------------------- |
    | `action`          | String | The request method.                                                                                  |
    | `organization`    | String | The unique identifier assigned to each company (organization) by the Chat service.                   |
    | `application`     | String | A unique internal ID assigned to each app by the Chat service. You can safely ignore this parameter. |
    | `applicationName` | String | The unique identifier assigned to each app by the Chat service .                                     |
    | `timestamp`       | Number | The Unix timestamp (ms) of the HTTP response.                                                        |
    | `duration`        | Number | The duration (ms) from when the HTTP request is sent to the time the response is received.           |
    | `path`            | String | The request path, which is part of the request URL. You can safely ignore this parameter.            |
    | `uri`             | String | The request URI.                                                                                     |
    | `entities `       | JSON   | The response entity.                                                                                 |
    | `data`            | JSON   | The response details.                                                                                |

    ## Authorization [#authorization-3]

    Chat RESTful APIs require Bearer HTTP authentication. Every time an HTTP request is sent, the following `Authorization` field must be filled in the request header:

    ```html
    Authorization: Bearer ${YourAppToken}
    ```

    In order to improve the security of the project, Agora uses a token (dynamic key) to authenticate users before they log in to the chat system. Chat RESTful APIs only support authenticating users using app tokens. For details, see [Authentication using App Token](/en/realtime-media/im/build/secure-access-and-authentication/authentication).

    ## Set the display name in push notifications [#set-the-display-name-in-push-notifications-3]

    Sets the nickname displayed in push notifications.

    For each App Key, the total call frequency limit of this method and the method to set the display style is 100 per second.

    ### HTTP request [#http-request-27]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{userId}
    ```

    #### Path parameter [#path-parameter-27]

    | Parameter | Type   | Description                      | Required |
    | :-------- | :----- | :------------------------------- | :------- |
    | `userId`  | String | The user ID of the current user. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#param).

    #### Request header [#request-header-27]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Accept`        | String | The parameter type. Set it as `application/json`.                                                                                                                                                       | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-15]

    | Parameter  | Type   | Description                                                                                                                   | Required |
    | :--------- | :----- | :---------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `nickname` | String | The nickname that is displayed in the push notification bar of the recipient's client when a message from the user is pushed. | No       |

    The length of `nickname` cannot exceed 100 characters. It supports the following character sets:

    * 26 lowercase English letters (a-z)
    * 26 uppercase English letters (A-Z)
    * 10 numbers (0-9)
    * Chinese characters
    * Special characters

    If no nickname is set, when a message from this user is pushed, the user ID of the message sender, instead of the nickname, is indicated in the notification details (`notification_display_style` is set to 1).

    <CalloutContainer type="info">
      <CalloutDescription>
        The nickname can be different from the nickname in user attributes. However, Agora recommends that you use the same nickname for both. Therefore, if either nickname is updated, the other should be changed at the same time. To update the nickname in user attributes, see [User attributes management](../user-attributes-management).
      </CalloutDescription>
    </CalloutContainer>

    ### HTTP response [#http-response-27]

    #### Response body [#response-body-27]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter   | Type   | Description                                                                                                                                                                                                            |
    | :---------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `uuid`      | String | A unique internal identifier generated by the Chat service for the user in this request.                                                                                                                               |
    | `type`      | String | The type of the chat. "user" indicates a One-to-one chat.                                                                                                                                                              |
    | `created`   | Number | The Unix timestamp (ms) when the user account is registered.                                                                                                                                                           |
    | `modified`  | Number | The Unix timestamp (ms) when the user information is last modified.                                                                                                                                                    |
    | `username`  | String | The ID of the user.                                                                                                                                                                                                    |
    | `activated` | Bool   | Whether the user account is active: `true`: The user account is active. `false`: The user account is deactivated. To unban a deactivated user account, refer to [Unbanning a user](../user-system-registration#unban). |
    | `nickname`  | String | The nickname displayed in push notifications.                                                                                                                                                                          |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-27]

    #### Request example [#request-example-27]

    ```bash
    curl -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer ' -d '{ "nickname": "testuser" }' 'http://XXXX/app-id/XXXX/users/user1'
    ```

    #### Response example [#response-example-27]

    ```json
    {
      "action": "put",
      "application": "8be024f0-XXXX-XXXX-b697-5d598d5f8402",
      "path": "/users",
      "uri": "https://XXXX/app-id/XXXX/users",
      "entities": [
        {
          "uuid": "4759aa70-XXXX-XXXX-925f-6fa0510823ba",
          "type": "user",
          "created": 1542595573399,
          "modified": 1542596083687,
          "username": "user1",
          "activated": true,
          "nickname": "testuser"
          }  ],
    "timestamp": 1542596083685,
    "duration": 6,
    "organization": "agora-demo",
    "applicationName": "testapp"
    }
    ```

    ## Set the display style in push notifications [#set-the-display-style-in-push-notifications-3]

    Sets the display style of push notifications.

    For each App Key, the total call frequency limit of this method and the method to set the display name is 100 per second.

    ### HTTP request [#http-request-28]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}
    ```

    #### Path parameter [#path-parameter-28]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-28]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-16]

    | Parameter                    | Type | Description                                                                                                                                                                                                                                                                                     | Required |
    | :--------------------------- | :--- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `notification_display_style` | Int  | The display style of push notifications: (Default) `0`: The push title is "You have a new message", and the push content is "Click to check". `1`: The push title is "You have a new message", and the push content contains the nickname of the sender and the content of the offline message. | Yes      |

    ### HTTP response [#http-response-28]

    #### Response body [#response-body-28]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter                    | Type   | Description                                                                                                                                                                                                            |
    | :--------------------------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `uuid`                       | String | A unique internal identifier generated by the Chat service for the user in this request.                                                                                                                               |
    | `type`                       | String | The type of the chat. "user" indicates a One-to-one chat.                                                                                                                                                              |
    | `created`                    | Number | The Unix timestamp (ms) when the user account is registered.                                                                                                                                                           |
    | `modified`                   | Number | The Unix timestamp (ms) when the user information is last modified.                                                                                                                                                    |
    | `username`                   | String | The ID of the user.                                                                                                                                                                                                    |
    | `activated`                  | Bool   | Whether the user account is active: `true`: The user account is active. `false`: The user account is deactivated. To unban a deactivated user account, refer to [Unbanning a user](../user-system-registration#unban). |
    | `notification_display_style` | Int    | The display style of push notifications. This parameter is returned only if you specify it when sending the request.                                                                                                   |
    | `nickname`                   | String | The nickname displayed in push notifications.                                                                                                                                                                          |
    | `notifier_name`              | String | The name of the push certificate.                                                                                                                                                                                      |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-28]

    #### Request example [#request-example-28]

    ```bash
    curl -X PUT -H "Authorization: Bearer " -i https://XXXX/app-id/XXXX/users/a -d '{"notification_display_style": "1"}'
    ```

    #### Response example [#response-example-28]

    ```json
    {
      "action" : "put",
      "application" : "17d59e50-XXXX-XXXX-8092-0dc80c0f5e99",
      "path" : "/users",
      "uri" : "https://XXXX/app-id/XXXX/users/XXXX",
      "entities" : [
        {
          "uuid" : "3b8c9890-XXXX-XXXX-9d88-f50bf55cafad",
          "type" : "user",
          "created" : 1530276298905,
          "modified" : 1534407146060,
          "username" : "user1",
          "activated" : true,
          "notification_display_style" : 1,
          "nickname" : "testuser",
          "notifier_name" : "2882303761517426801"
          } ],
    "timestamp" : 1534407146058,
    "duration" : 3,
    "organization" : "XXXX",
    "applicationName" : "XXXX"
    }
    ```

    ## Set up push notifications [#set-up-push-notifications-3]

    Sets the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-29]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}/notification/{chattype}/{key}
    ```

    #### Path parameter [#path-parameter-29]

    | Parameter  | Type   | Description                                                                                                                                                                      | Required |
    | :--------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `chattype` | String | The type of the chat: `user`: One-to-one chats. `chatgroup`: Group chats.                                                                                                        | Yes      |
    | `key`      | String | The identifier of the chat: If `type` is set to `user`, `key` indicates the user ID of the peer user. If `type` is set to `chatgroup`, `key` indicates the ID of the chat group. | Yes      |

    <CalloutContainer type="info">
      <CalloutDescription>
        To set up push notifications at the app level, you can set `type` to `user` and `key` to the user ID of the current user.
      </CalloutDescription>
    </CalloutContainer>

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-29]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-17]

    | Parameter        | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Required |
    | :--------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `type`           | String | The push notification mode: `DEFAULT`: A specific conversation uses the setting at the app level. This parameter is valid only for one-to-one and group chat conversations, but not for the app level. `ALL`: Receives push notifications for all offline messages. `AT`: Only receives push notifications for mentioned messages. `NONE`: Do not receive push notifications for offline messages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | No       |
    | `ignoreInterval` | String | The interval during which the DND mode is scheduled everyday. The value is in the format of `{HH:MM-HH:MM}`, for example, 08:30-10:00, where HH ranges from `00` to `23` in hour and MM from `00` to `59` in minute. This parameter works only when `chattype` is set to `user` and `key` to the current user ID in the request header, meaning that the DND interval is valid only for the entire app rather than specific one-to-one or group chat conversations. The DND mode is enabled everyday in the specified interval. For example, if you set this parameter to 08:00-10:00, the app stays in DND mode during 8:00-10:00; if you set the same period at 9:00, the DND mode works during 9:00-10:00 on the current day and 8:00-10:00 in later days. If the start time is set to the same time spot as the end time, like 00:00-00:00, the app enters the permanent DND mode. If the start time is later than the end time, the app remains in DND mode from the start time on the current day until the end time next day. For example, if you set 10:00-08:00, the DND mode lasts from 10:00 until 08:00 the next day.  Currently, only one DND interval is allowed, with the new setting overwriting the old. If this parameter is not specified, pass in an empty string. If both `ignoreInterval` and `ignoreDuration` are set, the DND mode works in both periods. For example, at 8:00, you set `ignoreInterval` to 8:00-10:00 and `ignoreDuration` to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days. | No       |
    | `ignoreDuration` | Number | The DND duration in milliseconds. The value range is \[0,604800000], where `0` indicates that this parameter is invalid and `604800000` indicates that the DND mode lasts for 7 days. This parameter works for both the app and one-to-one and group chat conversations in it.  Unlike `ignoreInterval` set as a daily period, this parameter specifies that the DND mode works only for the given duration starting from the current time. For example, if this parameter is set to 14400000 (4 hours) for the app at 8:00, the DND mode lasts only during 8:00-12:00 on the current day. If both `ignoreInterval` and `ignoreDuration` are set, the DND mode remains in both periods. For example, at 8:00, you set `ignoreInterval` to 8:00-10:00 and `ignoreDuration` to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | No       |

    <CalloutContainer type="info">
      <CalloutDescription>
        For both the app and all the conversations in the app, the DNS mode setting (`ignoreInterval` or `ignoreDuration`) takes precedence over the setting of the push notification mode (`type`). For example, assume that `ignoreInterval` or `ignoreDuration` is specified at the app level and `type` is set to `ALL` for a specific conversation. The app enters the DND mode during the designated period and you do not receive any push notifications during the period.
      </CalloutDescription>
    </CalloutContainer>

    ### HTTP response [#http-response-29]

    #### Response body [#response-body-29]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter        | Type   | Description                 |
    | :--------------- | :----- | :-------------------------- |
    | `type`           | String | The push notification mode. |
    | `ignoreInterval` | String | The DND time frame.         |
    | `ignoreDuration` | Long   | The DND duration.           |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-29]

    #### Request example [#request-example-29]

    ```bash
    curl -L -X PUT 'http://XXXX/app-id/XXXX/users/{username}/notification/user/{key}' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "type":"NONE",
        "ignoreInterval":"21:30-08:00",
        "ignoreDuration":86400000
    }'
    ```

    #### Response example [#response-example-29]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/user/hxtest",
        "timestamp": 1647503749918,
        "organization": "XXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "type": "NONE",
            "ignoreDuration": 1647590149924,
            "ignoreInterval": "21:30-08:00"
        },
        "duration": 20,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve the settings of push notifications [#retrieve-the-settings-of-push-notifications-3]

    Retrieves the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-30]

    ```html
    GET https://{host}/app-id/{app_id}/users/{username}/notification/{chattype}/{key}
    ```

    #### Path parameter [#path-parameter-30]

    | Parameter  | Type   | Description                                                                                                                                                                      | Required |
    | :--------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `chattype` | String | The type of the chat: `user`: One-to-one chats. `chatgroup`: Group chats.                                                                                                        | Yes      |
    | `key`      | String | The identifier of the chat: If `type` is set to `user`, `key` indicates the user ID of the peer user. If `type` is set to `chatgroup`, `key` indicates the ID of the chat group. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-30]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-30]

    #### Response body [#response-body-30]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter        | Type   | Description                 |
    | :--------------- | :----- | :-------------------------- |
    | `type`           | String | The push notification mode. |
    | `ignoreInterval` | String | The DND time frame.         |
    | `ignoreDuration` | Long   | The DND duration.           |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-30]

    #### Request example [#request-example-30]

    ```bash
    curl -L -X GET 'https://XXXX/app-id/XXXX/users/{username}/notification/chatgroup/{key}' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-30]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/chatgroup/12312312321",
        "timestamp": 1647503749918,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "get",
        "data": {
            "type": "NONE",
            "ignoreDuration": 1647590149924,
            "ignoreInterval": "21:30-08:00"
        },
        "duration": 20,
        "applicationName": "XXXX"
    }
    ```

    ## Set the preferred language of push notifications [#set-the-preferred-language-of-push-notifications-3]

    Sets the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-31]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}/notification/language
    ```

    #### Path parameter [#path-parameter-31]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-31]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-18]

    | Parameter             | Type   | Description                                                                                                                                                                     | Required |
    | :-------------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `translationLanguage` | String | The code for the language that the user prefers to see push notifications in. If set to an empty string, the server pushes the notifications of the original language directly. | Yes      |

    ### HTTP response [#http-response-31]

    #### Response body [#response-body-31]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter  | Type   | Description                                                                   |
    | :--------- | :----- | :---------------------------------------------------------------------------- |
    | `language` | String | The code for the language that the user prefers to see push notifications in. |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-31]

    #### Request example [#request-example-31]

    ```bash
    curl -L -X PUT 'https://XXXX/app-id/XXXX/users/{username}/notification/language' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "translationLanguage":"EU"
    }'
    ```

    #### Response example [#response-example-31]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/XXXX/notification/language",
        "timestamp": 1648089630244,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "language": "EU"
        },
        "duration": 66,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve the preferred language of push notifications [#retrieve-the-preferred-language-of-push-notifications-3]

    Retrieves the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-32]

    ```html
    GET https://{host}/app-id/{app_id}/users/{username}/notification/language
    ```

    #### Path parameter [#path-parameter-32]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-32]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-32]

    #### Response body [#response-body-32]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter  | Type   | Description                                                                   |
    | :--------- | :----- | :---------------------------------------------------------------------------- |
    | `language` | String | The code for the language that the user prefers to see push notifications in. |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-32]

    #### Request example [#request-example-32]

    ```bash
    curl -L -X GET 'https://XXXX/app-id/XXXX/users/{username}/notification/language' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-32]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/language",
        "timestamp": 1648089630244,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "language": "EU"
        },
        "duration": 66,
        "applicationName": "XXXX"
    }
    ```

    <a id="create-a-push-template" />

    ## Create a push template [#create-a-push-template-3]

    Creates a template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-33]

    ```html
    POST https://{host}/app-id/{app_id}/notification/template`
    ```

    For filling of template parameters, `title_args` and `content_args`, see the request body.

    #### Path parameter [#path-parameter-33]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-33]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-19]

    | Parameter         | Type   | Description                                                                                         | Required |
    | :---------------- | :----- | :-------------------------------------------------------------------------------------------------- | -------- |
    | `name`            | String | The name of the push template.                                                                      | Yes      |
    | `title_pattern`   | String | The custom title of the push template. You can add variables in the title, such as {0}.             | Yes      |
    | `content_pattern` | String | The custom content of the push template. You can add variables in the content, such as {0} and {1}. | Yes      |

    ### HTTP response [#http-response-33]

    #### Response body [#response-body-33]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-33]

    #### Request example [#request-example-33]

    ```bash
    curl -X POST 'https://XXXX/app-id/XXXX/notification/template' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "name": "test7",
        "title_pattern": "Hello,{0}",
        "content_pattern": "Test,{0}"
    }'
    ```

    #### Response example [#response-example-33]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template",
        "timestamp": 1646989584108,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "post",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 26,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve a push template [#retrieve-a-push-template-3]

    Retrieves the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-34]

    ```
    GET https://{host}/app-id/{app_id}/notification/template/{name}
    ```

    #### Path parameter [#path-parameter-34]

    | Parameter | Type   | Description                    | Required |
    | :-------- | :----- | :----------------------------- | -------- |
    | `name`    | String | The name of the push template. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-34]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-34]

    #### Response body [#response-body-34]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-34]

    #### Request example [#request-example-34]

    ```bash
    curl -X GET 'https://XXXX/app-id/XXXX/notification/template/{name}' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-34]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template/test7",
        "timestamp": 1646989686393,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "get",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 11,
        "applicationName": "XXXX"
    }
    ```

    ## Delete a push template [#delete-a-push-template-3]

    Deletes the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-35]

    ```html
    DELETE https://{host}/app-id/{app_id}/notification/template/{name}
    ```

    #### Path parameter [#path-parameter-35]

    | Parameter | Type   | Description                    | Required |
    | :-------- | :----- | :----------------------------- | -------- |
    | `name`    | String | The name of the push template. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-35]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-35]

    #### Response body [#response-body-35]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-35]

    #### Request example [#request-example-35]

    ```bash
    curl -X DELETE 'https://XXXX/app-id/XXXX/notification/template' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-35]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template",
        "timestamp": 1646989686393,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "delete",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 11,
        "applicationName": "XXXX"
    }
    ```

    ## Status codes [#status-codes-3]

    For details, see [HTTP Status Codes](../http-status-codes).

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="windows">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="windows" />

    This page shows how to call Chat RESTful APIs to set the display name, display style, push notification mode, and do-not-disturb (DND) mode.

    Before calling the following methods, ensure that you meet the following:

    * You understand the call frequency limit of the Chat RESTful APIs as described in [Limitations](../limitations#call-limit-of-server-sides).

    * You have activated the advanced features for push in [Agora Console](https://console.agora.io/v2). Advanced features allow you to set the push notification mode, do-not-disturb mode, and custom push template.

    <CalloutContainer type="info">
      <CalloutDescription>
        You must contact [support@agora.io](mailto\:support@agora.io) to disable the advanced features for push as this operation will delete all the relevant configurations.
      </CalloutDescription>
    </CalloutContainer>

    ## Common parameters [#common-parameters-4]

    The following table lists common request and response parameters of the Chat RESTful APIs:

    ### Request parameters [#request-parameters-4]

    | Parameter  | Type   | Description                                                                                                                                                                                                                             | Required |
    | :--------- | :----- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
    | `host`     | String | The domain name assigned by the Chat service to access RESTful APIs. For how to get the domain name, see [Get the information of your project](/en/realtime-media/im/get-started/enable#get-the-information-of-the-agora-chat-project). | Yes      |
    | `app_id`   | String | The unique identifier automatically assigned to each project by Agora                                                                                                                                                                   | Yes      |
    | `username` | String | The unique login account of the user.                                                                                                                                                                                                   | Yes      |

    ### Response parameters [#response-parameters-4]

    | Parameter         | Type   | Description                                                                                          |
    | :---------------- | :----- | :--------------------------------------------------------------------------------------------------- |
    | `action`          | String | The request method.                                                                                  |
    | `organization`    | String | The unique identifier assigned to each company (organization) by the Chat service.                   |
    | `application`     | String | A unique internal ID assigned to each app by the Chat service. You can safely ignore this parameter. |
    | `applicationName` | String | The unique identifier assigned to each app by the Chat service .                                     |
    | `timestamp`       | Number | The Unix timestamp (ms) of the HTTP response.                                                        |
    | `duration`        | Number | The duration (ms) from when the HTTP request is sent to the time the response is received.           |
    | `path`            | String | The request path, which is part of the request URL. You can safely ignore this parameter.            |
    | `uri`             | String | The request URI.                                                                                     |
    | `entities `       | JSON   | The response entity.                                                                                 |
    | `data`            | JSON   | The response details.                                                                                |

    ## Authorization [#authorization-4]

    Chat RESTful APIs require Bearer HTTP authentication. Every time an HTTP request is sent, the following `Authorization` field must be filled in the request header:

    ```html
    Authorization: Bearer ${YourAppToken}
    ```

    In order to improve the security of the project, Agora uses a token (dynamic key) to authenticate users before they log in to the chat system. Chat RESTful APIs only support authenticating users using app tokens. For details, see [Authentication using App Token](/en/realtime-media/im/build/secure-access-and-authentication/authentication).

    ## Set the display name in push notifications [#set-the-display-name-in-push-notifications-4]

    Sets the nickname displayed in push notifications.

    For each App Key, the total call frequency limit of this method and the method to set the display style is 100 per second.

    ### HTTP request [#http-request-36]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{userId}
    ```

    #### Path parameter [#path-parameter-36]

    | Parameter | Type   | Description                      | Required |
    | :-------- | :----- | :------------------------------- | :------- |
    | `userId`  | String | The user ID of the current user. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#param).

    #### Request header [#request-header-36]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Accept`        | String | The parameter type. Set it as `application/json`.                                                                                                                                                       | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-20]

    | Parameter  | Type   | Description                                                                                                                   | Required |
    | :--------- | :----- | :---------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `nickname` | String | The nickname that is displayed in the push notification bar of the recipient's client when a message from the user is pushed. | No       |

    The length of `nickname` cannot exceed 100 characters. It supports the following character sets:

    * 26 lowercase English letters (a-z)
    * 26 uppercase English letters (A-Z)
    * 10 numbers (0-9)
    * Chinese characters
    * Special characters

    If no nickname is set, when a message from this user is pushed, the user ID of the message sender, instead of the nickname, is indicated in the notification details (`notification_display_style` is set to 1).

    <CalloutContainer type="info">
      <CalloutDescription>
        The nickname can be different from the nickname in user attributes. However, Agora recommends that you use the same nickname for both. Therefore, if either nickname is updated, the other should be changed at the same time. To update the nickname in user attributes, see [User attributes management](../user-attributes-management).
      </CalloutDescription>
    </CalloutContainer>

    ### HTTP response [#http-response-36]

    #### Response body [#response-body-36]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter   | Type   | Description                                                                                                                                                                                                            |
    | :---------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `uuid`      | String | A unique internal identifier generated by the Chat service for the user in this request.                                                                                                                               |
    | `type`      | String | The type of the chat. "user" indicates a One-to-one chat.                                                                                                                                                              |
    | `created`   | Number | The Unix timestamp (ms) when the user account is registered.                                                                                                                                                           |
    | `modified`  | Number | The Unix timestamp (ms) when the user information is last modified.                                                                                                                                                    |
    | `username`  | String | The ID of the user.                                                                                                                                                                                                    |
    | `activated` | Bool   | Whether the user account is active: `true`: The user account is active. `false`: The user account is deactivated. To unban a deactivated user account, refer to [Unbanning a user](../user-system-registration#unban). |
    | `nickname`  | String | The nickname displayed in push notifications.                                                                                                                                                                          |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-36]

    #### Request example [#request-example-36]

    ```bash
    curl -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer ' -d '{ "nickname": "testuser" }' 'http://XXXX/app-id/XXXX/users/user1'
    ```

    #### Response example [#response-example-36]

    ```json
    {
      "action": "put",
      "application": "8be024f0-XXXX-XXXX-b697-5d598d5f8402",
      "path": "/users",
      "uri": "https://XXXX/app-id/XXXX/users",
      "entities": [
        {
          "uuid": "4759aa70-XXXX-XXXX-925f-6fa0510823ba",
          "type": "user",
          "created": 1542595573399,
          "modified": 1542596083687,
          "username": "user1",
          "activated": true,
          "nickname": "testuser"
          }  ],
    "timestamp": 1542596083685,
    "duration": 6,
    "organization": "agora-demo",
    "applicationName": "testapp"
    }
    ```

    ## Set the display style in push notifications [#set-the-display-style-in-push-notifications-4]

    Sets the display style of push notifications.

    For each App Key, the total call frequency limit of this method and the method to set the display name is 100 per second.

    ### HTTP request [#http-request-37]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}
    ```

    #### Path parameter [#path-parameter-37]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-37]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-21]

    | Parameter                    | Type | Description                                                                                                                                                                                                                                                                                     | Required |
    | :--------------------------- | :--- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `notification_display_style` | Int  | The display style of push notifications: (Default) `0`: The push title is "You have a new message", and the push content is "Click to check". `1`: The push title is "You have a new message", and the push content contains the nickname of the sender and the content of the offline message. | Yes      |

    ### HTTP response [#http-response-37]

    #### Response body [#response-body-37]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter                    | Type   | Description                                                                                                                                                                                                            |
    | :--------------------------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `uuid`                       | String | A unique internal identifier generated by the Chat service for the user in this request.                                                                                                                               |
    | `type`                       | String | The type of the chat. "user" indicates a One-to-one chat.                                                                                                                                                              |
    | `created`                    | Number | The Unix timestamp (ms) when the user account is registered.                                                                                                                                                           |
    | `modified`                   | Number | The Unix timestamp (ms) when the user information is last modified.                                                                                                                                                    |
    | `username`                   | String | The ID of the user.                                                                                                                                                                                                    |
    | `activated`                  | Bool   | Whether the user account is active: `true`: The user account is active. `false`: The user account is deactivated. To unban a deactivated user account, refer to [Unbanning a user](../user-system-registration#unban). |
    | `notification_display_style` | Int    | The display style of push notifications. This parameter is returned only if you specify it when sending the request.                                                                                                   |
    | `nickname`                   | String | The nickname displayed in push notifications.                                                                                                                                                                          |
    | `notifier_name`              | String | The name of the push certificate.                                                                                                                                                                                      |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-37]

    #### Request example [#request-example-37]

    ```bash
    curl -X PUT -H "Authorization: Bearer " -i https://XXXX/app-id/XXXX/users/a -d '{"notification_display_style": "1"}'
    ```

    #### Response example [#response-example-37]

    ```json
    {
      "action" : "put",
      "application" : "17d59e50-XXXX-XXXX-8092-0dc80c0f5e99",
      "path" : "/users",
      "uri" : "https://XXXX/app-id/XXXX/users/XXXX",
      "entities" : [
        {
          "uuid" : "3b8c9890-XXXX-XXXX-9d88-f50bf55cafad",
          "type" : "user",
          "created" : 1530276298905,
          "modified" : 1534407146060,
          "username" : "user1",
          "activated" : true,
          "notification_display_style" : 1,
          "nickname" : "testuser",
          "notifier_name" : "2882303761517426801"
          } ],
    "timestamp" : 1534407146058,
    "duration" : 3,
    "organization" : "XXXX",
    "applicationName" : "XXXX"
    }
    ```

    ## Set up push notifications [#set-up-push-notifications-4]

    Sets the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-38]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}/notification/{chattype}/{key}
    ```

    #### Path parameter [#path-parameter-38]

    | Parameter  | Type   | Description                                                                                                                                                                      | Required |
    | :--------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `chattype` | String | The type of the chat: `user`: One-to-one chats. `chatgroup`: Group chats.                                                                                                        | Yes      |
    | `key`      | String | The identifier of the chat: If `type` is set to `user`, `key` indicates the user ID of the peer user. If `type` is set to `chatgroup`, `key` indicates the ID of the chat group. | Yes      |

    <CalloutContainer type="info">
      <CalloutDescription>
        To set up push notifications at the app level, you can set `type` to `user` and `key` to the user ID of the current user.
      </CalloutDescription>
    </CalloutContainer>

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-38]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-22]

    | Parameter        | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Required |
    | :--------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `type`           | String | The push notification mode: `DEFAULT`: A specific conversation uses the setting at the app level. This parameter is valid only for one-to-one and group chat conversations, but not for the app level. `ALL`: Receives push notifications for all offline messages. `AT`: Only receives push notifications for mentioned messages. `NONE`: Do not receive push notifications for offline messages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | No       |
    | `ignoreInterval` | String | The interval during which the DND mode is scheduled everyday. The value is in the format of `{HH:MM-HH:MM}`, for example, 08:30-10:00, where HH ranges from `00` to `23` in hour and MM from `00` to `59` in minute. This parameter works only when `chattype` is set to `user` and `key` to the current user ID in the request header, meaning that the DND interval is valid only for the entire app rather than specific one-to-one or group chat conversations. The DND mode is enabled everyday in the specified interval. For example, if you set this parameter to 08:00-10:00, the app stays in DND mode during 8:00-10:00; if you set the same period at 9:00, the DND mode works during 9:00-10:00 on the current day and 8:00-10:00 in later days. If the start time is set to the same time spot as the end time, like 00:00-00:00, the app enters the permanent DND mode. If the start time is later than the end time, the app remains in DND mode from the start time on the current day until the end time next day. For example, if you set 10:00-08:00, the DND mode lasts from 10:00 until 08:00 the next day.  Currently, only one DND interval is allowed, with the new setting overwriting the old. If this parameter is not specified, pass in an empty string. If both `ignoreInterval` and `ignoreDuration` are set, the DND mode works in both periods. For example, at 8:00, you set `ignoreInterval` to 8:00-10:00 and `ignoreDuration` to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days. | No       |
    | `ignoreDuration` | Number | The DND duration in milliseconds. The value range is \[0,604800000], where `0` indicates that this parameter is invalid and `604800000` indicates that the DND mode lasts for 7 days. This parameter works for both the app and one-to-one and group chat conversations in it.  Unlike `ignoreInterval` set as a daily period, this parameter specifies that the DND mode works only for the given duration starting from the current time. For example, if this parameter is set to 14400000 (4 hours) for the app at 8:00, the DND mode lasts only during 8:00-12:00 on the current day. If both `ignoreInterval` and `ignoreDuration` are set, the DND mode remains in both periods. For example, at 8:00, you set `ignoreInterval` to 8:00-10:00 and `ignoreDuration` to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | No       |

    <CalloutContainer type="info">
      <CalloutDescription>
        For both the app and all the conversations in the app, the DNS mode setting (`ignoreInterval` or `ignoreDuration`) takes precedence over the setting of the push notification mode (`type`). For example, assume that `ignoreInterval` or `ignoreDuration` is specified at the app level and `type` is set to `ALL` for a specific conversation. The app enters the DND mode during the designated period and you do not receive any push notifications during the period.
      </CalloutDescription>
    </CalloutContainer>

    ### HTTP response [#http-response-38]

    #### Response body [#response-body-38]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter        | Type   | Description                 |
    | :--------------- | :----- | :-------------------------- |
    | `type`           | String | The push notification mode. |
    | `ignoreInterval` | String | The DND time frame.         |
    | `ignoreDuration` | Long   | The DND duration.           |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-38]

    #### Request example [#request-example-38]

    ```bash
    curl -L -X PUT 'http://XXXX/app-id/XXXX/users/{username}/notification/user/{key}' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "type":"NONE",
        "ignoreInterval":"21:30-08:00",
        "ignoreDuration":86400000
    }'
    ```

    #### Response example [#response-example-38]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/user/hxtest",
        "timestamp": 1647503749918,
        "organization": "XXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "type": "NONE",
            "ignoreDuration": 1647590149924,
            "ignoreInterval": "21:30-08:00"
        },
        "duration": 20,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve the settings of push notifications [#retrieve-the-settings-of-push-notifications-4]

    Retrieves the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-39]

    ```html
    GET https://{host}/app-id/{app_id}/users/{username}/notification/{chattype}/{key}
    ```

    #### Path parameter [#path-parameter-39]

    | Parameter  | Type   | Description                                                                                                                                                                      | Required |
    | :--------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `chattype` | String | The type of the chat: `user`: One-to-one chats. `chatgroup`: Group chats.                                                                                                        | Yes      |
    | `key`      | String | The identifier of the chat: If `type` is set to `user`, `key` indicates the user ID of the peer user. If `type` is set to `chatgroup`, `key` indicates the ID of the chat group. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-39]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-39]

    #### Response body [#response-body-39]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter        | Type   | Description                 |
    | :--------------- | :----- | :-------------------------- |
    | `type`           | String | The push notification mode. |
    | `ignoreInterval` | String | The DND time frame.         |
    | `ignoreDuration` | Long   | The DND duration.           |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-39]

    #### Request example [#request-example-39]

    ```bash
    curl -L -X GET 'https://XXXX/app-id/XXXX/users/{username}/notification/chatgroup/{key}' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-39]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/chatgroup/12312312321",
        "timestamp": 1647503749918,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "get",
        "data": {
            "type": "NONE",
            "ignoreDuration": 1647590149924,
            "ignoreInterval": "21:30-08:00"
        },
        "duration": 20,
        "applicationName": "XXXX"
    }
    ```

    ## Set the preferred language of push notifications [#set-the-preferred-language-of-push-notifications-4]

    Sets the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-40]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}/notification/language
    ```

    #### Path parameter [#path-parameter-40]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-40]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-23]

    | Parameter             | Type   | Description                                                                                                                                                                     | Required |
    | :-------------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `translationLanguage` | String | The code for the language that the user prefers to see push notifications in. If set to an empty string, the server pushes the notifications of the original language directly. | Yes      |

    ### HTTP response [#http-response-40]

    #### Response body [#response-body-40]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter  | Type   | Description                                                                   |
    | :--------- | :----- | :---------------------------------------------------------------------------- |
    | `language` | String | The code for the language that the user prefers to see push notifications in. |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-40]

    #### Request example [#request-example-40]

    ```bash
    curl -L -X PUT 'https://XXXX/app-id/XXXX/users/{username}/notification/language' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "translationLanguage":"EU"
    }'
    ```

    #### Response example [#response-example-40]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/XXXX/notification/language",
        "timestamp": 1648089630244,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "language": "EU"
        },
        "duration": 66,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve the preferred language of push notifications [#retrieve-the-preferred-language-of-push-notifications-4]

    Retrieves the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-41]

    ```html
    GET https://{host}/app-id/{app_id}/users/{username}/notification/language
    ```

    #### Path parameter [#path-parameter-41]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-41]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-41]

    #### Response body [#response-body-41]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter  | Type   | Description                                                                   |
    | :--------- | :----- | :---------------------------------------------------------------------------- |
    | `language` | String | The code for the language that the user prefers to see push notifications in. |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-41]

    #### Request example [#request-example-41]

    ```bash
    curl -L -X GET 'https://XXXX/app-id/XXXX/users/{username}/notification/language' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-41]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/language",
        "timestamp": 1648089630244,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "language": "EU"
        },
        "duration": 66,
        "applicationName": "XXXX"
    }
    ```

    <a id="create-a-push-template" />

    ## Create a push template [#create-a-push-template-4]

    Creates a template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-42]

    ```html
    POST https://{host}/app-id/{app_id}/notification/template`
    ```

    For filling of template parameters, `title_args` and `content_args`, see the request body.

    #### Path parameter [#path-parameter-42]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-42]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-24]

    | Parameter         | Type   | Description                                                                                         | Required |
    | :---------------- | :----- | :-------------------------------------------------------------------------------------------------- | -------- |
    | `name`            | String | The name of the push template.                                                                      | Yes      |
    | `title_pattern`   | String | The custom title of the push template. You can add variables in the title, such as {0}.             | Yes      |
    | `content_pattern` | String | The custom content of the push template. You can add variables in the content, such as {0} and {1}. | Yes      |

    ### HTTP response [#http-response-42]

    #### Response body [#response-body-42]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-42]

    #### Request example [#request-example-42]

    ```bash
    curl -X POST 'https://XXXX/app-id/XXXX/notification/template' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "name": "test7",
        "title_pattern": "Hello,{0}",
        "content_pattern": "Test,{0}"
    }'
    ```

    #### Response example [#response-example-42]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template",
        "timestamp": 1646989584108,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "post",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 26,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve a push template [#retrieve-a-push-template-4]

    Retrieves the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-43]

    ```
    GET https://{host}/app-id/{app_id}/notification/template/{name}
    ```

    #### Path parameter [#path-parameter-43]

    | Parameter | Type   | Description                    | Required |
    | :-------- | :----- | :----------------------------- | -------- |
    | `name`    | String | The name of the push template. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-43]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-43]

    #### Response body [#response-body-43]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-43]

    #### Request example [#request-example-43]

    ```bash
    curl -X GET 'https://XXXX/app-id/XXXX/notification/template/{name}' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-43]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template/test7",
        "timestamp": 1646989686393,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "get",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 11,
        "applicationName": "XXXX"
    }
    ```

    ## Delete a push template [#delete-a-push-template-4]

    Deletes the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-44]

    ```html
    DELETE https://{host}/app-id/{app_id}/notification/template/{name}
    ```

    #### Path parameter [#path-parameter-44]

    | Parameter | Type   | Description                    | Required |
    | :-------- | :----- | :----------------------------- | -------- |
    | `name`    | String | The name of the push template. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-44]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-44]

    #### Response body [#response-body-44]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-44]

    #### Request example [#request-example-44]

    ```bash
    curl -X DELETE 'https://XXXX/app-id/XXXX/notification/template' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-44]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template",
        "timestamp": 1646989686393,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "delete",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 11,
        "applicationName": "XXXX"
    }
    ```

    ## Status codes [#status-codes-4]

    For details, see [HTTP Status Codes](../http-status-codes).

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="unity">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="unity" />

    This page shows how to call Chat RESTful APIs to set the display name, display style, push notification mode, and do-not-disturb (DND) mode.

    Before calling the following methods, ensure that you meet the following:

    * You understand the call frequency limit of the Chat RESTful APIs as described in [Limitations](../limitations#call-limit-of-server-sides).

    * You have activated the advanced features for push in [Agora Console](https://console.agora.io/v2). Advanced features allow you to set the push notification mode, do-not-disturb mode, and custom push template.

    <CalloutContainer type="info">
      <CalloutDescription>
        You must contact [support@agora.io](mailto\:support@agora.io) to disable the advanced features for push as this operation will delete all the relevant configurations.
      </CalloutDescription>
    </CalloutContainer>

    ## Common parameters [#common-parameters-5]

    The following table lists common request and response parameters of the Chat RESTful APIs:

    ### Request parameters [#request-parameters-5]

    | Parameter  | Type   | Description                                                                                                                                                                                                                             | Required |
    | :--------- | :----- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
    | `host`     | String | The domain name assigned by the Chat service to access RESTful APIs. For how to get the domain name, see [Get the information of your project](/en/realtime-media/im/get-started/enable#get-the-information-of-the-agora-chat-project). | Yes      |
    | `app_id`   | String | The unique identifier automatically assigned to each project by Agora                                                                                                                                                                   | Yes      |
    | `username` | String | The unique login account of the user.                                                                                                                                                                                                   | Yes      |

    ### Response parameters [#response-parameters-5]

    | Parameter         | Type   | Description                                                                                          |
    | :---------------- | :----- | :--------------------------------------------------------------------------------------------------- |
    | `action`          | String | The request method.                                                                                  |
    | `organization`    | String | The unique identifier assigned to each company (organization) by the Chat service.                   |
    | `application`     | String | A unique internal ID assigned to each app by the Chat service. You can safely ignore this parameter. |
    | `applicationName` | String | The unique identifier assigned to each app by the Chat service .                                     |
    | `timestamp`       | Number | The Unix timestamp (ms) of the HTTP response.                                                        |
    | `duration`        | Number | The duration (ms) from when the HTTP request is sent to the time the response is received.           |
    | `path`            | String | The request path, which is part of the request URL. You can safely ignore this parameter.            |
    | `uri`             | String | The request URI.                                                                                     |
    | `entities `       | JSON   | The response entity.                                                                                 |
    | `data`            | JSON   | The response details.                                                                                |

    ## Authorization [#authorization-5]

    Chat RESTful APIs require Bearer HTTP authentication. Every time an HTTP request is sent, the following `Authorization` field must be filled in the request header:

    ```html
    Authorization: Bearer ${YourAppToken}
    ```

    In order to improve the security of the project, Agora uses a token (dynamic key) to authenticate users before they log in to the chat system. Chat RESTful APIs only support authenticating users using app tokens. For details, see [Authentication using App Token](/en/realtime-media/im/build/secure-access-and-authentication/authentication).

    ## Set the display name in push notifications [#set-the-display-name-in-push-notifications-5]

    Sets the nickname displayed in push notifications.

    For each App Key, the total call frequency limit of this method and the method to set the display style is 100 per second.

    ### HTTP request [#http-request-45]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{userId}
    ```

    #### Path parameter [#path-parameter-45]

    | Parameter | Type   | Description                      | Required |
    | :-------- | :----- | :------------------------------- | :------- |
    | `userId`  | String | The user ID of the current user. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#param).

    #### Request header [#request-header-45]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Accept`        | String | The parameter type. Set it as `application/json`.                                                                                                                                                       | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-25]

    | Parameter  | Type   | Description                                                                                                                   | Required |
    | :--------- | :----- | :---------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `nickname` | String | The nickname that is displayed in the push notification bar of the recipient's client when a message from the user is pushed. | No       |

    The length of `nickname` cannot exceed 100 characters. It supports the following character sets:

    * 26 lowercase English letters (a-z)
    * 26 uppercase English letters (A-Z)
    * 10 numbers (0-9)
    * Chinese characters
    * Special characters

    If no nickname is set, when a message from this user is pushed, the user ID of the message sender, instead of the nickname, is indicated in the notification details (`notification_display_style` is set to 1).

    <CalloutContainer type="info">
      <CalloutDescription>
        The nickname can be different from the nickname in user attributes. However, Agora recommends that you use the same nickname for both. Therefore, if either nickname is updated, the other should be changed at the same time. To update the nickname in user attributes, see [User attributes management](../user-attributes-management).
      </CalloutDescription>
    </CalloutContainer>

    ### HTTP response [#http-response-45]

    #### Response body [#response-body-45]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter   | Type   | Description                                                                                                                                                                                                            |
    | :---------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `uuid`      | String | A unique internal identifier generated by the Chat service for the user in this request.                                                                                                                               |
    | `type`      | String | The type of the chat. "user" indicates a One-to-one chat.                                                                                                                                                              |
    | `created`   | Number | The Unix timestamp (ms) when the user account is registered.                                                                                                                                                           |
    | `modified`  | Number | The Unix timestamp (ms) when the user information is last modified.                                                                                                                                                    |
    | `username`  | String | The ID of the user.                                                                                                                                                                                                    |
    | `activated` | Bool   | Whether the user account is active: `true`: The user account is active. `false`: The user account is deactivated. To unban a deactivated user account, refer to [Unbanning a user](../user-system-registration#unban). |
    | `nickname`  | String | The nickname displayed in push notifications.                                                                                                                                                                          |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-45]

    #### Request example [#request-example-45]

    ```bash
    curl -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Authorization: Bearer ' -d '{ "nickname": "testuser" }' 'http://XXXX/app-id/XXXX/users/user1'
    ```

    #### Response example [#response-example-45]

    ```json
    {
      "action": "put",
      "application": "8be024f0-XXXX-XXXX-b697-5d598d5f8402",
      "path": "/users",
      "uri": "https://XXXX/app-id/XXXX/users",
      "entities": [
        {
          "uuid": "4759aa70-XXXX-XXXX-925f-6fa0510823ba",
          "type": "user",
          "created": 1542595573399,
          "modified": 1542596083687,
          "username": "user1",
          "activated": true,
          "nickname": "testuser"
          }  ],
    "timestamp": 1542596083685,
    "duration": 6,
    "organization": "agora-demo",
    "applicationName": "testapp"
    }
    ```

    ## Set the display style in push notifications [#set-the-display-style-in-push-notifications-5]

    Sets the display style of push notifications.

    For each App Key, the total call frequency limit of this method and the method to set the display name is 100 per second.

    ### HTTP request [#http-request-46]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}
    ```

    #### Path parameter [#path-parameter-46]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-46]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-26]

    | Parameter                    | Type | Description                                                                                                                                                                                                                                                                                     | Required |
    | :--------------------------- | :--- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `notification_display_style` | Int  | The display style of push notifications: (Default) `0`: The push title is "You have a new message", and the push content is "Click to check". `1`: The push title is "You have a new message", and the push content contains the nickname of the sender and the content of the offline message. | Yes      |

    ### HTTP response [#http-response-46]

    #### Response body [#response-body-46]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter                    | Type   | Description                                                                                                                                                                                                            |
    | :--------------------------- | :----- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `uuid`                       | String | A unique internal identifier generated by the Chat service for the user in this request.                                                                                                                               |
    | `type`                       | String | The type of the chat. "user" indicates a One-to-one chat.                                                                                                                                                              |
    | `created`                    | Number | The Unix timestamp (ms) when the user account is registered.                                                                                                                                                           |
    | `modified`                   | Number | The Unix timestamp (ms) when the user information is last modified.                                                                                                                                                    |
    | `username`                   | String | The ID of the user.                                                                                                                                                                                                    |
    | `activated`                  | Bool   | Whether the user account is active: `true`: The user account is active. `false`: The user account is deactivated. To unban a deactivated user account, refer to [Unbanning a user](../user-system-registration#unban). |
    | `notification_display_style` | Int    | The display style of push notifications. This parameter is returned only if you specify it when sending the request.                                                                                                   |
    | `nickname`                   | String | The nickname displayed in push notifications.                                                                                                                                                                          |
    | `notifier_name`              | String | The name of the push certificate.                                                                                                                                                                                      |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-46]

    #### Request example [#request-example-46]

    ```bash
    curl -X PUT -H "Authorization: Bearer " -i https://XXXX/app-id/XXXX/users/a -d '{"notification_display_style": "1"}'
    ```

    #### Response example [#response-example-46]

    ```json
    {
      "action" : "put",
      "application" : "17d59e50-XXXX-XXXX-8092-0dc80c0f5e99",
      "path" : "/users",
      "uri" : "https://XXXX/app-id/XXXX/users/XXXX",
      "entities" : [
        {
          "uuid" : "3b8c9890-XXXX-XXXX-9d88-f50bf55cafad",
          "type" : "user",
          "created" : 1530276298905,
          "modified" : 1534407146060,
          "username" : "user1",
          "activated" : true,
          "notification_display_style" : 1,
          "nickname" : "testuser",
          "notifier_name" : "2882303761517426801"
          } ],
    "timestamp" : 1534407146058,
    "duration" : 3,
    "organization" : "XXXX",
    "applicationName" : "XXXX"
    }
    ```

    ## Set up push notifications [#set-up-push-notifications-5]

    Sets the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-47]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}/notification/{chattype}/{key}
    ```

    #### Path parameter [#path-parameter-47]

    | Parameter  | Type   | Description                                                                                                                                                                      | Required |
    | :--------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `chattype` | String | The type of the chat: `user`: One-to-one chats. `chatgroup`: Group chats.                                                                                                        | Yes      |
    | `key`      | String | The identifier of the chat: If `type` is set to `user`, `key` indicates the user ID of the peer user. If `type` is set to `chatgroup`, `key` indicates the ID of the chat group. | Yes      |

    <CalloutContainer type="info">
      <CalloutDescription>
        To set up push notifications at the app level, you can set `type` to `user` and `key` to the user ID of the current user.
      </CalloutDescription>
    </CalloutContainer>

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-47]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-27]

    | Parameter        | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Required |
    | :--------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `type`           | String | The push notification mode: `DEFAULT`: A specific conversation uses the setting at the app level. This parameter is valid only for one-to-one and group chat conversations, but not for the app level. `ALL`: Receives push notifications for all offline messages. `AT`: Only receives push notifications for mentioned messages. `NONE`: Do not receive push notifications for offline messages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | No       |
    | `ignoreInterval` | String | The interval during which the DND mode is scheduled everyday. The value is in the format of `{HH:MM-HH:MM}`, for example, 08:30-10:00, where HH ranges from `00` to `23` in hour and MM from `00` to `59` in minute. This parameter works only when `chattype` is set to `user` and `key` to the current user ID in the request header, meaning that the DND interval is valid only for the entire app rather than specific one-to-one or group chat conversations. The DND mode is enabled everyday in the specified interval. For example, if you set this parameter to 08:00-10:00, the app stays in DND mode during 8:00-10:00; if you set the same period at 9:00, the DND mode works during 9:00-10:00 on the current day and 8:00-10:00 in later days. If the start time is set to the same time spot as the end time, like 00:00-00:00, the app enters the permanent DND mode. If the start time is later than the end time, the app remains in DND mode from the start time on the current day until the end time next day. For example, if you set 10:00-08:00, the DND mode lasts from 10:00 until 08:00 the next day.  Currently, only one DND interval is allowed, with the new setting overwriting the old. If this parameter is not specified, pass in an empty string. If both `ignoreInterval` and `ignoreDuration` are set, the DND mode works in both periods. For example, at 8:00, you set `ignoreInterval` to 8:00-10:00 and `ignoreDuration` to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days. | No       |
    | `ignoreDuration` | Number | The DND duration in milliseconds. The value range is \[0,604800000], where `0` indicates that this parameter is invalid and `604800000` indicates that the DND mode lasts for 7 days. This parameter works for both the app and one-to-one and group chat conversations in it.  Unlike `ignoreInterval` set as a daily period, this parameter specifies that the DND mode works only for the given duration starting from the current time. For example, if this parameter is set to 14400000 (4 hours) for the app at 8:00, the DND mode lasts only during 8:00-12:00 on the current day. If both `ignoreInterval` and `ignoreDuration` are set, the DND mode remains in both periods. For example, at 8:00, you set `ignoreInterval` to 8:00-10:00 and `ignoreDuration` to 14400000 (4 hours) for the app, the app stays in DND mode during 8:00-12:00 on the current day and 8:00-10:00 in the later days.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | No       |

    <CalloutContainer type="info">
      <CalloutDescription>
        For both the app and all the conversations in the app, the DNS mode setting (`ignoreInterval` or `ignoreDuration`) takes precedence over the setting of the push notification mode (`type`). For example, assume that `ignoreInterval` or `ignoreDuration` is specified at the app level and `type` is set to `ALL` for a specific conversation. The app enters the DND mode during the designated period and you do not receive any push notifications during the period.
      </CalloutDescription>
    </CalloutContainer>

    ### HTTP response [#http-response-47]

    #### Response body [#response-body-47]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter        | Type   | Description                 |
    | :--------------- | :----- | :-------------------------- |
    | `type`           | String | The push notification mode. |
    | `ignoreInterval` | String | The DND time frame.         |
    | `ignoreDuration` | Long   | The DND duration.           |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-47]

    #### Request example [#request-example-47]

    ```bash
    curl -L -X PUT 'http://XXXX/app-id/XXXX/users/{username}/notification/user/{key}' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "type":"NONE",
        "ignoreInterval":"21:30-08:00",
        "ignoreDuration":86400000
    }'
    ```

    #### Response example [#response-example-47]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/user/hxtest",
        "timestamp": 1647503749918,
        "organization": "XXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "type": "NONE",
            "ignoreDuration": 1647590149924,
            "ignoreInterval": "21:30-08:00"
        },
        "duration": 20,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve the settings of push notifications [#retrieve-the-settings-of-push-notifications-5]

    Retrieves the push notification and DND modes at both the app and conversation levels.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-48]

    ```html
    GET https://{host}/app-id/{app_id}/users/{username}/notification/{chattype}/{key}
    ```

    #### Path parameter [#path-parameter-48]

    | Parameter  | Type   | Description                                                                                                                                                                      | Required |
    | :--------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
    | `chattype` | String | The type of the chat: `user`: One-to-one chats. `chatgroup`: Group chats.                                                                                                        | Yes      |
    | `key`      | String | The identifier of the chat: If `type` is set to `user`, `key` indicates the user ID of the peer user. If `type` is set to `chatgroup`, `key` indicates the ID of the chat group. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-48]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-48]

    #### Response body [#response-body-48]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter        | Type   | Description                 |
    | :--------------- | :----- | :-------------------------- |
    | `type`           | String | The push notification mode. |
    | `ignoreInterval` | String | The DND time frame.         |
    | `ignoreDuration` | Long   | The DND duration.           |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-48]

    #### Request example [#request-example-48]

    ```bash
    curl -L -X GET 'https://XXXX/app-id/XXXX/users/{username}/notification/chatgroup/{key}' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-48]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/chatgroup/12312312321",
        "timestamp": 1647503749918,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "get",
        "data": {
            "type": "NONE",
            "ignoreDuration": 1647590149924,
            "ignoreInterval": "21:30-08:00"
        },
        "duration": 20,
        "applicationName": "XXXX"
    }
    ```

    ## Set the preferred language of push notifications [#set-the-preferred-language-of-push-notifications-5]

    Sets the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-49]

    ```html
    PUT https://{host}/app-id/{app_id}/users/{username}/notification/language
    ```

    #### Path parameter [#path-parameter-49]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-49]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-28]

    | Parameter             | Type   | Description                                                                                                                                                                     | Required |
    | :-------------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `translationLanguage` | String | The code for the language that the user prefers to see push notifications in. If set to an empty string, the server pushes the notifications of the original language directly. | Yes      |

    ### HTTP response [#http-response-49]

    #### Response body [#response-body-49]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter  | Type   | Description                                                                   |
    | :--------- | :----- | :---------------------------------------------------------------------------- |
    | `language` | String | The code for the language that the user prefers to see push notifications in. |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-49]

    #### Request example [#request-example-49]

    ```bash
    curl -L -X PUT 'https://XXXX/app-id/XXXX/users/{username}/notification/language' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "translationLanguage":"EU"
    }'
    ```

    #### Response example [#response-example-49]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/XXXX/notification/language",
        "timestamp": 1648089630244,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "language": "EU"
        },
        "duration": 66,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve the preferred language of push notifications [#retrieve-the-preferred-language-of-push-notifications-5]

    Retrieves the preferred language of push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-50]

    ```html
    GET https://{host}/app-id/{app_id}/users/{username}/notification/language
    ```

    #### Path parameter [#path-parameter-50]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-50]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-50]

    #### Response body [#response-body-50]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter  | Type   | Description                                                                   |
    | :--------- | :----- | :---------------------------------------------------------------------------- |
    | `language` | String | The code for the language that the user prefers to see push notifications in. |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-50]

    #### Request example [#request-example-50]

    ```bash
    curl -L -X GET 'https://XXXX/app-id/XXXX/users/{username}/notification/language' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-50]

    ```json
    {
        "path": "/users",
        "uri": "https://XXXX/app-id/XXXX/users/notification/language",
        "timestamp": 1648089630244,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "put",
        "data": {
            "language": "EU"
        },
        "duration": 66,
        "applicationName": "XXXX"
    }
    ```

    <a id="create-a-push-template" />

    ## Create a push template [#create-a-push-template-5]

    Creates a template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-51]

    ```html
    POST https://{host}/app-id/{app_id}/notification/template`
    ```

    For filling of template parameters, `title_args` and `content_args`, see the request body.

    #### Path parameter [#path-parameter-51]

    For the descriptions of path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-51]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Content-Type`  | String | The content type. Set it as `application/json`.                                                                                                                                                         | Yes      |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    #### Request body [#request-body-29]

    | Parameter         | Type   | Description                                                                                         | Required |
    | :---------------- | :----- | :-------------------------------------------------------------------------------------------------- | -------- |
    | `name`            | String | The name of the push template.                                                                      | Yes      |
    | `title_pattern`   | String | The custom title of the push template. You can add variables in the title, such as {0}.             | Yes      |
    | `content_pattern` | String | The custom content of the push template. You can add variables in the content, such as {0} and {1}. | Yes      |

    ### HTTP response [#http-response-51]

    #### Response body [#response-body-51]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-51]

    #### Request example [#request-example-51]

    ```bash
    curl -X POST 'https://XXXX/app-id/XXXX/notification/template' \
    -H 'Authorization: Bearer ' \
    -H 'Content-Type: application/json' \
    --data-raw '{
        "name": "test7",
        "title_pattern": "Hello,{0}",
        "content_pattern": "Test,{0}"
    }'
    ```

    #### Response example [#response-example-51]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template",
        "timestamp": 1646989584108,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "post",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 26,
        "applicationName": "XXXX"
    }
    ```

    ## Retrieve a push template [#retrieve-a-push-template-5]

    Retrieves the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-52]

    ```
    GET https://{host}/app-id/{app_id}/notification/template/{name}
    ```

    #### Path parameter [#path-parameter-52]

    | Parameter | Type   | Description                    | Required |
    | :-------- | :----- | :----------------------------- | -------- |
    | `name`    | String | The name of the push template. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-52]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-52]

    #### Response body [#response-body-52]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-52]

    #### Request example [#request-example-52]

    ```bash
    curl -X GET 'https://XXXX/app-id/XXXX/notification/template/{name}' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-52]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template/test7",
        "timestamp": 1646989686393,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "get",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 11,
        "applicationName": "XXXX"
    }
    ```

    ## Delete a push template [#delete-a-push-template-5]

    Deletes the specified template for push notifications.

    For each App Key, the call frequency limit of this method is 100 per second.

    ### HTTP request [#http-request-53]

    ```html
    DELETE https://{host}/app-id/{app_id}/notification/template/{name}
    ```

    #### Path parameter [#path-parameter-53]

    | Parameter | Type   | Description                    | Required |
    | :-------- | :----- | :----------------------------- | -------- |
    | `name`    | String | The name of the push template. | Yes      |

    For the descriptions of other path parameters, see [Common Parameters](#request).

    #### Request header [#request-header-53]

    | Parameter       | Type   | Description                                                                                                                                                                                             | Required |
    | :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
    | `Authorization` | String | The authentication token of the user or administrator, in the format of `Bearer ${YourAppToken}`, where `Bearer` is a fixed character, followed by an English space, and then the obtained token value. | Yes      |

    ### HTTP response [#http-response-53]

    #### Response body [#response-body-53]

    If the returned HTTP status code is `200`, the request succeeds, and the response body contains the following fields:

    | Parameter         | Type   | Description                                                 |
    | :---------------- | :----- | :---------------------------------------------------------- |
    | `name`            | String | The name of the push template.                              |
    | `createAt`        | Number | The Unix timestamp (ms) when the template is created.       |
    | `updateAt`        | Number | The Unix timestamp (ms) when the template is last modified. |
    | `title_pattern`   | String | The custom title of the push template.                      |
    | `content_pattern` | String | The custom content of the push template.                    |

    For other fields and detailed descriptions, see [Common parameters](#response).

    If the returned HTTP status code is not `200`, the request fails. You can refer to [Status codes](#status-codes) for possible reasons.

    ### Example [#example-53]

    #### Request example [#request-example-53]

    ```bash
    curl -X DELETE 'https://XXXX/app-id/XXXX/notification/template' \
    -H 'Authorization: Bearer '
    ```

    #### Response example [#response-example-53]

    ```json
    {
        "uri": "https://XXXX/app-id/XXXX/notification/template",
        "timestamp": 1646989686393,
        "organization": "XXXX",
        "application": "17fe201b-XXXX-XXXX-83df-1ed1ebd7b227",
        "action": "delete",
        "data": {
            "name": "test7",
            "createAt": 1646989584124,
            "updateAt": 1646989584124,
            "title_pattern": "Hello,{0}",
            "content_pattern": "Test,{0}"
        },
        "duration": 11,
        "applicationName": "XXXX"
    }
    ```

    ## Status codes [#status-codes-5]

    For details, see [HTTP Status Codes](../http-status-codes).

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>
</_PlatformTabsGroup>
