# Update a group With the update group operation, you can add and remove members in an existing group as well as rename the group. This method encompasses a few ways to update a group: 1. By using add and remove arrays containing phone numbers, you control the group movements. Any list of valid numbers in E.164 format can be added. 2. By using the auto_update object, your customer can add or remove themselves from groups. 3. You can also add or remove other groups into this group with add_from_group and remove_from_group. #### Other group update info - The request will not be rejected for duplicate adds or unknown removes. - The additions will be done before the deletions. If an phone number is on both lists, it will not be apart of the resulting group. - Updating a group targeted by a batch message scheduled in the future is allowed. Changes will be reflected when the batch is sent. Endpoint: POST /xms/v1/{service_plan_id}/groups/{group_id} Version: v1 Security: BearerAuth ## Path parameters: - `service_plan_id` (string, required) Your service plan ID. You can find this on your Dashboard. Example: "jd63jf88477ll123ab4567cd89012ef3" - `group_id` (string, required) ID of a group that you are interested in getting. ## Request fields (application/json): - `add` (array) Add a list of phone numbers (MSISDNs) to this group. The phone numbers are a strings within an array and must be in [E.164 format](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537). - `remove` (array) Remove a list of phone numbers (MSISDNs) to this group.The phone numbers are a strings within an array and must be in [E.164 format](https://community.sinch.com/t5/Glossary/E-164/ta-p/7537). - `name` (string) The name of the group. Omitting name from the JSON body will leave the name unchanged. To remove an existing name set, name explicitly to the JSON value null. - `add_from_group` (string) Copy the members from the another group into this group. Constraints: Must be valid group ID - `remove_from_group` (string) Remove the members in a specified group from this group. Constraints: Must be valid group ID - `auto_update` (object) - `auto_update.to` (string, required) Short code or long number addressed in [MO](https://community.sinch.com/t5/Glossary/MO-Mobile-Originated/ta-p/7618). Constraints: Must be valid phone number or short code which has been provisioned by your account manager. Example: "+15551231234" - `auto_update.add` (object) Keyword to be sent in MO to add MSISDN to a group - `auto_update.add.first_word` (string, required) Opt-in keyword like "JOIN" if _auto_update.to_ is dedicated long/short number or unique brand keyword like "Sinch" if it is a shared short code. Example: "Sinch" - `auto_update.add.second_word` (string) Opt-in keyword like "JOIN" if _auto_update.to_ is shared short code. Example: "JOIN" - `auto_update.remove` (object) Keyword to be sent in MO to remove MSISDN to a group - `auto_update.remove.first_word` (string, required) Opt-out keyword like "LEAVE" if _auto_update.to_ is dedicated long/short number or unique brand keyword like "Sinch" if it is a shared short code. Example: "LEAVE" - `auto_update.remove.second_word` (string) Opt-out keyword like "LEAVE" if _auto_update.to_ is shared short code. ## Response 200 fields (application/json): - `id` (string) The ID used to reference this group. Example: "01FC66621VHDBN119Z8PMV1QPQ" - `name` (string) Name of group if set. Example: "My new customers" - `size` (integer) The number of members currently in the group. Example: 2 - `created_at` (string) Timestamp for group creation. Format: YYYY-MM-DDThh:mm:ss.SSSZ - `modified_at` (string) Timestamp for when the group was last updated. Format: YYYY-MM-DDThh:mm:ss.SSSZ - `child_groups` (array) Phone numbers [MSIDNs](https://community.sinch.com/t5/Glossary/MSISDN/ta-p/7628) of child group will be included in this group. If present then this group will be auto populated. Constraints: Elements must be group IDs. Example: ["01FC66621VHDBN119Z8PMV1AHY"] - `auto_update` (object) - `auto_update.to` (string, required) Short code or long number addressed in [MO](https://community.sinch.com/t5/Glossary/MO-Mobile-Originated/ta-p/7618). Constraints: Must be valid phone number or short code which has been provisioned by your account manager. Example: "+15551231234" - `auto_update.add` (object) Keyword to be sent in MO to add MSISDN to a group - `auto_update.add.first_word` (string, required) Opt-in keyword like "JOIN" if _auto_update.to_ is dedicated long/short number or unique brand keyword like "Sinch" if it is a shared short code. Example: "Sinch" - `auto_update.add.second_word` (string) Opt-in keyword like "JOIN" if _auto_update.to_ is shared short code. Example: "JOIN" - `auto_update.remove` (object) Keyword to be sent in MO to remove MSISDN to a group - `auto_update.remove.first_word` (string, required) Opt-out keyword like "LEAVE" if _auto_update.to_ is dedicated long/short number or unique brand keyword like "Sinch" if it is a shared short code. Example: "LEAVE" - `auto_update.remove.second_word` (string) Opt-out keyword like "LEAVE" if _auto_update.to_ is shared short code. ## Response 400 fields (application/json): - `code` (string) The error code. See [error codes](https://developers.sinch.com/docs/sms/api-reference/status-codes/). - `text` (string) The human readable description of the error. ## Response 403 fields (application/json): - `code` (string) The error code. See [error codes](https://developers.sinch.com/docs/sms/api-reference/status-codes/). - `text` (string) The human readable description of the error.