# Updating a Channel

There are two ways to update a channel with the Stream API: partial updates and full updates. A partial update preserves existing custom key–value data, while a full update replaces the entire channel object and removes any fields not included in the request.

## Partial Update

A partial update lets you set or unset specific fields without affecting the rest of the channel’s custom data — essentially a patch-style update.

```php label="PHP"
use GetStream\ChatClient;
use GetStream\GeneratedModels as Models;

// Here's a channel with some custom field data that might be useful
$client->getOrCreateChannel("messaging", "thierry-jenny", new Models\ChannelGetOrCreateRequest(
    data: new Models\ChannelInput(
        createdByID: "thierry",
        custom: (object)[
            "source" => "user",
            "source_detail" => (object)["user_id" => 123],
            "channel_detail" => (object)["topic" => "Plants and Animals", "rating" => "pg"],
        ],
    ),
));

// let's change the source of this channel
$client->updateChannelPartial("messaging", "thierry-jenny", new Models\UpdateChannelPartialRequest(
    set: (object)["source" => "system"],
));

// since it's system generated we no longer need source_detail
$client->updateChannelPartial("messaging", "thierry-jenny", new Models\UpdateChannelPartialRequest(
    unset: ["source_detail"],
));

// and finally update one of the nested fields in the channel_detail
$client->updateChannelPartial("messaging", "thierry-jenny", new Models\UpdateChannelPartialRequest(
    set: (object)["channel_detail.topic" => "Nature"],
));

// and maybe we decide we no longer need a rating
$client->updateChannelPartial("messaging", "thierry-jenny", new Models\UpdateChannelPartialRequest(
    unset: ["channel_detail.rating"],
));
```

## Full Update

The `update` function updates all of the channel data. **Any data that is present on the channel and not included in a full update will be deleted.**

```php label="PHP"
use GetStream\ChatClient;
use GetStream\GeneratedModels as Models;

$client->updateChannel("messaging", "general", new Models\UpdateChannelRequest(
    data: new Models\ChannelInputRequest(
        custom: (object)["name" => "myspecialchannel", "color" => "green"],
    ),
    message: new Models\MessageRequest(
        text: "Thierry changed the channel color to green",
        userID: "thierry",
    ),
));
```

### Request Params

| Name         | Type   | Description                                                                                                                                                                          | Optional |
| ------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
| channel data | object | Object with the new channel information. One special field is "frozen". Setting this field to true will freeze the channel. Read more about freezing channels in "Freezing Channels" |          |
| text         | object | Message object allowing you to show a system message in the Channel that something changed.                                                                                          | Yes      |

>
> **Info:** Updating a channel using these methods cannot be used to add or remove members. For this, you must use specific methods for adding/removing members, more information can be found [here](https://getstream.io/chat/docs/php/channel-members/).
>

---

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/php/channel-update/](https://getstream.io/chat/docs/php/channel-update/).