> ## Documentation Index
> Fetch the complete documentation index at: https://docs.quickblox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Dialog

> Update a dialog.

### Recipes

<AccordionGroup>
  <Accordion title="Update dialog name">
    <Steps>
      <Step title="1. Set a name of the dialog">
        You can set a `name` field for a `group` or `public` dialog only.

        ```curl {5} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "name":"New Year 2020 party"
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="2. Set the ID of the dialog that should be updated">
        To get a dialog ID, use a [List Dialogs](/reference/list-dialogs) request.

        ```curl {7} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "name":"New Year 2020 party"
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="3. As a result, the API returns a dialog with an updated name.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "name":"New Year 2020 party"
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Add participants to the dialog">
    <Steps>
      <Step title="1. Append participants to the array with participants IDs">
        Use a `push_all` operator to append participants to the array with participants IDs.

        ```curl {5} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "push_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="2. Set the participants that should be added to the dialog">
        Set the participants IDs to an `occupants_ids` array to add participants to the dialog.

        ```curl {6-9} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "push_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="3. Set the ID of the dialog that should be updated">
        To get a dialog ID, use a [List Dialogs](/reference/list-dialogs) request.

        ```curl {12} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "push_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="4. As a result, the API returns a dialog with new dialog participants.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "push_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Update custom data of the dialog">
    <Steps>
      <Step title="1. Set a custom object that should be updated">
        Use a `data` parameter to refer to a custom object that should be updated. The data stores data as a set of unique keys each having an associated value parameter.

        See [this section](/reference/create-class) to learn how to create a custom object class.

        ```curl {5-11} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 8be2595b87f403f3c39e38fb39942cf481012bba" \
        -d '{ 
          "data":{ 
            "class_name":"CoolDialog",
            "category":"co-workers",
            "floor":"5",
            "is_intern":"true",
            "average_kpi":"0.8"
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5cc748eca0eb470d452adaaa.json
        ```
      </Step>

      <Step title="2. Set a name of the class">
        Here, we refer to the `CoolDialog` custom object class.

        ```curl {6} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 8be2595b87f403f3c39e38fb39942cf481012bba" \
        -d '{ 
          "data":{ 
            "class_name":"CoolDialog",
            "category":"co-workers",
            "floor":"5",
            "is_intern":"true",
            "average_kpi":"0.8"
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5cc748eca0eb470d452adaaa.json
        ```
      </Step>

      <Step title="3. Specify custom object fields and their new values">
        Here, we refer to custom object fields of the `Cooldialog` class and set new values to these fields.

        ```curl {7-10} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 8be2595b87f403f3c39e38fb39942cf481012bba" \
        -d '{ 
          "data":{ 
            "class_name":"CoolDialog",
            "category":"co-workers",
            "floor":"5",
            "is_intern":"true",
            "average_kpi":"0.8"
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5cc748eca0eb470d452adaaa.json
        ```
      </Step>

      <Step title="4. Set the ID of the dialog that should be updated">
        To get a dialog ID, use a [List Dialogs](/reference/list-dialogs) request.

        ```curl {13} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 8be2595b87f403f3c39e38fb39942cf481012bba" \
        -d '{ 
          "data":{ 
            "class_name":"CoolDialog",
            "category":"co-workers",
            "floor":"5",
            "is_intern":"true",
            "average_kpi":"0.8"
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5cc748eca0eb470d452adaaa.json
        ```
      </Step>

      <Step title="5. As a result, the API returns a dialog with updated custom data.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 8be2595b87f403f3c39e38fb39942cf481012bba" \
        -d '{ 
          "data":{ 
            "class_name":"CoolDialog",
            "category":"co-workers",
            "floor":"5",
            "is_intern":"true",
            "average_kpi":"0.8"
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5cc748eca0eb470d452adaaa.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Remove participants from dialog">
    <Steps>
      <Step title="1. Specify if you want to remove dialog participants">
        Use a `pull_all` operator to remove participants from the array with participants IDs.

        ```curl {5} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "pull_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="2. Set the participants that should be removed from the dialog">
        Set participants IDs to an `occupants_ids` array to remove the participants from the dialog.

        ```curl {6-9} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "pull_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="3. Set the ID of the dialog that should be updated">
        To get a dialog ID, use a [List Dialogs](/reference/list-dialogs) request.

        ```curl {2} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "pull_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="4. As a result, the API returns a dialog with an updated 'occupants_ids' array list.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "pull_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Update dialog name with API key">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {3} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "name":"New Year 2024 party"
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="2. Use 'On-Behalf-Of' header to pass user_id">
        To execute a request on behalf of a specific user

        ```curl {4} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "name":"New Year 2024 party"
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="3. Set a name of the dialog">
        You can set a name field for a group or public dialog only.

        ```curl {6} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "name":"New Year 2024 party"
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="4. Set the ID of the dialog that should be updated">
        To get a dialog ID, use a [List Dialogs](/reference/list-dialogs) request.

        ```curl {8} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "name":"New Year 2024 party"
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="5. As a result, the API returns a dialog with an updated name.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "name":"New Year 2024 party"
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Update dialog owner (added in v2.39.0)">
    <Steps>
      <Step title="1. Set user_id of the dialog">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{
          "user_id": 96753877
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="2. Set the ID of the dialog that should be updated">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{
          "user_id": 96753877
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="3. As a result, the API returns a dialog with an updated user_id.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{
          "user_id": 96753877
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Add admins to the dialog (added in v2.52.0)">
    <Steps>
      <Step title="1. Append admins to the array with participants IDs">
        Use a `push_all` operator to append admins to the array with participants IDs.

        ```curl {5} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{
          "push_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="2. Set the participants that should be added to the dialog">
        Set the participants IDs to an `admin_ids` array to add participants to the dialog.

        ```curl {6-9} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{
          "push_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="3. Set the ID of the dialog that should be updated">
        To get a dialog ID, use a [List Dialogs](/reference/list-dialogs) request.

        ```curl {12} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{
          "push_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="4. As a result, the API returns a dialog with new dialog admins.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{
          "push_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Remove admins from dialog (added in v2.52.0)">
    <Steps>
      <Step title="1. Specify if you want to remove dialog admins">
        Use a `pull_all` operator to remove admins from the array with participants IDs.

        ```curl {5} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{
          "pull_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="2. Set the admins that should be removed from the dialog">
        Set participants IDs to an `admin_ids` array to remove the participants from the dialog.

        ```curl {6-9} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{
          "pull_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="3. Set the ID of the dialog that should be updated">
        To get a dialog ID, use a [List Dialogs](/reference/list-dialogs) request.

        ```curl {12} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{
          "pull_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="4. As a result, the API returns a dialog with an updated 'admin_ids' array list.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{
          "pull_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Add participants to the dialog with API key">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {3} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "push_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="2. Use 'On-Behalf-Of' header to pass user_id">
        To execute a request on behalf of a specific user.

        ```curl {4} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "push_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="3. Append participants to the array with participants IDs">
        Use a `push_all` operator to append participants to the array with participants IDs.

        ```curl {6} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "push_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="4. Set the participants that should be added to the dialog">
        Set the participants IDs to an `occupants_ids` array to add participants to the dialog.

        ```curl {7-10} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "push_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="5. Set the ID of the dialog that should be updated">
        To get a dialog ID, use a [List Dialogs](/reference/list-dialogs) request.

        ```curl {13} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "push_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="6. As a result, the API returns a dialog with new dialog participants.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{  
          "push_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Remove participants from dialog with API key">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {3} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H 'Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI' \
        -H 'On-Behalf-Of: 123' \
        -d '{  
          "pull_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="2. Use 'On-Behalf-Of' header to pass user_id">
        To execute a request on behalf of a specific user.

        ```curl {4} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H 'Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI' \
        -H 'On-Behalf-Of: 123' \
        -d '{  
          "pull_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="3. Specify if you want to remove dialog participants">
        Use a `pull_all` operator to remove participants from the array with participants IDs.

        ```curl {6} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H 'Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI' \
        -H 'On-Behalf-Of: 123' \
        -d '{  
          "pull_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="4. Set the participants that should be removed from the dialog">
        Set participants IDs to an `occupants_ids` array to remove the participants from the dialog.

        ```curl {7-10} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H 'Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI' \
        -H 'On-Behalf-Of: 123' \
        -d '{  
          "pull_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="5. Set the ID of the dialog that should be updated">
        To get a dialog ID, use a [List Dialogs](/reference/list-dialogs) request.

        ```curl {13} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H 'Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI' \
        -H 'On-Behalf-Of: 123' \
        -d '{  
          "pull_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="6. As a result, the API returns a dialog with an updated 'occupants_ids' array list.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H 'Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI' \
        -H 'On-Behalf-Of: 123' \
        -d '{  
          "pull_all":{  
            "occupants_ids":[  
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Update custom data of the dialog with API key">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {3} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{ 
          "data":{ 
            "class_name":"CoolDialog",
            "category":"co-workers",
            "floor":"5",
            "is_intern":"true",
            "average_kpi":"0.8"
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5cc748eca0eb470d452adaaa.json
        ```
      </Step>

      <Step title="2. Use 'On-Behalf-Of' header to pass user_id">
        To execute a request on behalf of a specific user.

        ```curl {4} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{ 
          "data":{ 
            "class_name":"CoolDialog",
            "category":"co-workers",
            "floor":"5",
            "is_intern":"true",
            "average_kpi":"0.8"
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5cc748eca0eb470d452adaaa.json
        ```
      </Step>

      <Step title="3. Set a custom object that should be updated">
        Use a data parameter to refer to a custom object that should be updated. The data stores data as a set of unique keys each having an associated value parameter.

        See this section to learn how to create a custom object class.

        ```curl {6-12} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{ 
          "data":{ 
            "class_name":"CoolDialog",
            "category":"co-workers",
            "floor":"5",
            "is_intern":"true",
            "average_kpi":"0.8"
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5cc748eca0eb470d452adaaa.json
        ```
      </Step>

      <Step title="4. Set a name of the class">
        Here, we refer to the `CoolDialog` custom object class.

        ```curl {7} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{ 
          "data":{ 
            "class_name":"CoolDialog",
            "category":"co-workers",
            "floor":"5",
            "is_intern":"true",
            "average_kpi":"0.8"
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5cc748eca0eb470d452adaaa.json
        ```
      </Step>

      <Step title="5. Specify custom object fields and their new values">
        Here, we refer to custom object fields of the `Cooldialog` class and set new values to these fields.

        ```curl {8-11} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{ 
          "data":{ 
            "class_name":"CoolDialog",
            "category":"co-workers",
            "floor":"5",
            "is_intern":"true",
            "average_kpi":"0.8"
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5cc748eca0eb470d452adaaa.json
        ```
      </Step>

      <Step title="6. Set the ID of the dialog that should be updated">
        To get a dialog ID, use a [List Dialogs](/reference/list-dialogs) request.

        ```curl {14} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{ 
          "data":{ 
            "class_name":"CoolDialog",
            "category":"co-workers",
            "floor":"5",
            "is_intern":"true",
            "average_kpi":"0.8"
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5cc748eca0eb470d452adaaa.json
        ```
      </Step>

      <Step title="7. As a result, the API returns a dialog with updated custom data.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{ 
          "data":{ 
            "class_name":"CoolDialog",
            "category":"co-workers",
            "floor":"5",
            "is_intern":"true",
            "average_kpi":"0.8"
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5cc748eca0eb470d452adaaa.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Update is_join_required parameter (added in v2.34.0)">
    <Steps>
      <Step title="1. Set is_join_required value">
        You can update the `is_join_required` field for `GROUP` dialogs only (`type=2`).

        Possible values:

        * `0` — join not required
        * `1` — join required

        ```curl {5} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -d '{
          "is_join_required": 0
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="2. Set the ID of the dialog that should be updated">
        To get a dialog ID, use a [List Dialogs](/reference/list-dialogs) request.

        ```curl {7} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -d '{
          "is_join_required": 0
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="3. Result">
        The API returns the updated dialog with the modified `is_join_required` value.

        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -d '{
          "is_join_required": 0
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Update dialog owner (added in v2.39.0)">
    <Steps>
      <Step title="1. Set user_id of the dialog">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "user_id": 96753877
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="2. Set the ID of the dialog that should be updated">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "user_id": 96753877
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="3. As a result, the API returns a dialog with an updated user_id.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
        -d '{  
          "user_id": 96753877
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Add admins to the dialog with API key (added in v2.52.0)">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {3} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{
          "push_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="2. Use 'On-Behalf-Of' header to pass user_id">
        To execute a request on behalf of a specific user.

        ```curl {4} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{
          "push_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="3. Append admins to the array with participants IDs">
        Use a `push_all` operator to append admins to the array with participants IDs.

        ```curl {6} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{
          "push_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="4. Set the admins that should be added to the dialog">
        Set the admins IDs to an `admin_ids` array to add participants to the dialog.

        ```curl {7-10} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{
          "push_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="5. Set the ID of the dialog that should be updated">
        To get a dialog ID, use a [List Dialogs](/reference/list-dialogs) request.

        ```curl {13} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{
          "push_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="6. As a result, the API returns a dialog with new dialog admins.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        -d '{
          "push_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Remove admins from dialog with API key (added in v2.52.0)">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {3} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H 'Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI' \
        -H 'On-Behalf-Of: 123' \
        -d '{
          "pull_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="2. Use 'On-Behalf-Of' header to pass user_id">
        To execute a request on behalf of a specific user.

        ```curl {4} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H 'Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI' \
        -H 'On-Behalf-Of: 123' \
        -d '{
          "pull_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="3. Specify if you want to remove dialog admins">
        Use a `pull_all` operator to remove admins from the array with participants IDs.

        ```curl {6} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H 'Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI' \
        -H 'On-Behalf-Of: 123' \
        -d '{
          "pull_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="4. Set the admins that should be removed from the dialog">
        Set admins IDs to an `admin_ids` array to remove the participants from the dialog.

        ```curl {7-10} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H 'Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI' \
        -H 'On-Behalf-Of: 123' \
        -d '{
          "pull_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="5. Set the ID of the dialog that should be updated">
        To get a dialog ID, use a [List Dialogs](/reference/list-dialogs) request.

        ```curl {13} theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H 'Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI' \
        -H 'On-Behalf-Of: 123' \
        -d '{
          "pull_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>

      <Step title="6. As a result, the API returns a dialog with an updated 'admin_ids' array list.">
        ```curl theme={null}
        curl -X PUT \
        -H "Content-Type: application/json" \
        -H 'Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI' \
        -H 'On-Behalf-Of: 123' \
        -d '{
          "pull_all":{
            "admin_ids":[
              91375295,
              96705448
            ]
          }
        }' \
        https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
        ```
      </Step>
    </Steps>
  </Accordion>
</AccordionGroup>

The following rules are applied if dialog's `type=3` (PRIVATE):

* **Any** user from `occupants_ids` can update custom parameters.

The following rules are applied if dialog's `type=2` (GROUP): <br />
Admin Support (introduced in v2.52.0)

* **Any** user from `occupants_ids` can add **other** users.

* **Any** user from `occupants_ids` can remove only **himself**.

* **Any** user from `occupants_ids` can update custom parameters.

* Dialog's **owner** (creator) and **admin** can remove **any** users from `occupants_ids`.

* Only dialog's **owner** (creator) can add **other** users to `admin_ids`.

* Only dialog's **owner** (creator) can remove **any** users from `admin_ids`.

* **Admins** can remove themselves from `admin_ids`.

The following rules are applied if dialog's `type=1` (PUBLIC\_GROUP):

* Dialog’s **owner** (creator) and **admin** can update it.

* Only dialog's **owner** (creator) can add **other** users to `admin_ids`.

* Only dialog's **owner** (creator) can remove **any** users from `admin_ids`.

* **Admins** can remove themselves from `admin_ids`.

#### Path Parameters

<ParamField path="chat_dialog_id" type="string" required> ID of the dialog to which a current message is connected. Generated automatically by the server after message creation</ParamField>

#### Body Parameters

<ParamField body="name" type="string"> Name of a dialog. The maximum length is 200 symbols. </ParamField>
<ParamField body="photo" type="string"> Photo of the dialog. </ParamField>

<ParamField body="is_join_required" type="integer">
  Defines whether a user must perform a join operation before sending and receiving messages via XMPP. Applies only to `type=2` (GROUP).

  Possible values: <br />
  `0` — join not required, <br />
  `1` — join required. <br />

  (added in v2.34.0).
</ParamField>

<ParamField body="push_all" type="object">
  <Expandable title="properties">
    <ParamField body="occupants_ids" type="array of integers">
      Update dialog occupants. Use `push_all` operator to **add** new occupants.
    </ParamField>

    <ParamField body="admin_ids" type="array of integers">
      Update dialog admins. Use `push_all` operator to **add** new admins.(added in v2.52.0)
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="pull_all" type="object">
  <Expandable title="properties">
    <ParamField body="occupants_ids" type="array of integers">
      Update dialog occupants. Use `pull_all` to **remove** occupants.
    </ParamField>

    <ParamField body="admin_ids" type="array of integers">
      Update dialog admins. Use `pull_all` to **remove** admins.(added in v2.52.0)
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="data" type="object">
  <Expandable title="properties">
    <ParamField body="class_name" type="string">
      Class name in Custom Objects.
    </ParamField>

    <ParamField body="{class_field_N}" type="string">
      Field name of class in Custom Objects. Can be many: 1..N.
    </ParamField>
  </Expandable>
</ParamField>

#### Headers

<ParamField header="QB-Token" type="string" required> A user or application session token. See [Authentication](/reference/authentication) page to learn more about session tokens. Must be used either QB-Token or Authorization. </ParamField>
<ParamField header="Authorization" type="string" default="ApiKey {your_api_key}"> API key from Dashboard. Expected format: `ApiKey {your_api_key}`. Must be used either QB-Token or Authorization.</ParamField>
<ParamField header="On-Behalf-Of" type="string">User ID. The user ID of the user on whose behalf the request is being made.</ParamField>

#### Responses

<AccordionGroup>
  <Accordion title="200">
    A successful response

    <ResponseField name="_id" type="string" />

    <ResponseField name="created_at" type="string" />

    <ResponseField name="last_message" type="string" />

    <ResponseField name="last_message_date_sent" type="integer" />

    <ResponseField name="last_message_id" type="string" />

    <ResponseField name="last_message_user_id" type="integer" />

    <ResponseField name="name" type="string" />

    <ResponseField name="occupants_ids" type="array of integers" />

    <ResponseField name="admin_ids" type="array of integers (added in v2.52.0)" />

    <ResponseField name="photo" type="string" />

    <ResponseField name="type" type="integer" />

    <ResponseField name="updated_at" type="string" />

    <ResponseField name="user_id" type="integer" />

    <ResponseField name="xmpp_room_jid" type="string" />

    <ResponseField name="unread_messages_count" type="string" />

    <ResponseField name="is_join_required" type="integer" />
  </Accordion>

  <Accordion title="400">
    An error response

    <ResponseField name="errors" type="array of strings" />
  </Accordion>

  <Accordion title="403">
    An error response

    <ResponseField name="errors" type="array of strings" />
  </Accordion>
</AccordionGroup>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PUT \
  -H "Content-Type: application/json" \
  -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
  -d '{  
    "name":"New Year 2020 party"
  }' \
  https://api.quickblox.com/chat/Dialog/5d75393ba28f9a17e1cb0f9e.json
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "_id": "5d75393ba28f9a17e1cb0f9e",
    "created_at": "2019-09-08T17:24:11Z",
    "last_message": "sure, I can wait",
    "last_message_date_sent": 1567971414,
    "last_message_id": "5d755856a0eb47411e0b72a9",
    "last_message_user_id": 96753878,
    "name": "New Year 2020 party",
    "occupants_ids": [
      96753878,
      96754523,
      96830631,
      96831328,
      96831397
    ],
    "admin_ids": [],
    "photo": "68123",
    "type": 2,
    "updated_at": "2019-09-08T19:36:54Z",
    "user_id": 96753878,
    "xmpp_room_jid": "76730_5d75393ba28f9a17e1cb0f9e@muc.chat.quickblox.com",
    "unread_messages_count": 0,
    "is_join_required": 1
  }
  ```

  ```json 400 theme={null}
  {
    "errors": [
      "Users are already present in occupants_ids"
    ]
  }
  // If an invalid value is provided when modifying the is_join_required parameter
  {
    "errors": [
      "Parameter \"is_join_required\" should be a number: either 0 or 1."
    ]
  }
  ```

  ```json 403 theme={null}
  {
    "errors": [
      "You don't have appropriate permissions to perform this operation"
    ]
  }

  // If a user who is neither the account owner nor the dialog owner attempts to modify the is_join_required parameter
  {
    "errors": [
      "You do not have permission to modify the \"is_join_required\" parameter."
    ]
  }

  {
    "errors": [
      "You don't have appropriate permissions to modify or delete \"admin_ids\". "
    ]
  }
  ```
</ResponseExample>
