# Update a project channel

Source: https://www.jawsdeploy.net/rest-api/project-channel-update | Section: Project Channels

Update a channel's name, description, lifecycle binding, default flag, or version rules.

`PUT /api/project/channel`

Pass only the fields you want to change. Setting `isDefault = false` on the current default makes the project have no default channel until another one is promoted.

**Omitting a field leaves it unchanged; sending an empty value clears it.** That distinction applies to every rule field: omit `versionRange` to leave the stored range alone, or send `""` to remove the constraint. Likewise omit `packageRules` to leave the existing rules untouched, or send `[]` to remove all of them. When you do send `packageRules`, the list **replaces** the stored rules wholesale - there is no partial update of a single rule.

### How the rules are evaluated

A channel gates two things, and each is optional - a blank field means *no constraint*.

- The **release version rule** (`versionRange`, `versionTagRegex`) gates which release versions may be created in the channel.
- The **package rules** (`packageRules`) gate which package versions may be pinned into those releases.

`versionRange` bounds the version **number** and takes no account of the prerelease tag; `versionTagRegex` decides whether tagged versions are allowed at all. The endpoints of a range therefore compare on the number alone, so `[2.0,4.0)` accepts `2.0.0-beta` and rejects `4.0.0-beta`. This differs from raw NuGet range semantics, which sort a prerelease below its own release.

`versionTagRegex` is matched against the prerelease label **without** the leading `-`, and against an empty string for a stable version. So `^$` accepts stable versions only, `^.+$` accepts prereleases only, and `^beta.*$` accepts `2.1.0-beta3` but not `2.1.0` or `2.1.0-rc1`. The app's channel editor shows `^$` as *Stable only* and `^.+$` as *Prereleases only*; any other expression shows as a custom pattern. There is no separate mode field to set.

`packageRules` are evaluated **in order and the first rule whose `packageFilter` matches a package wins**; a package matched by no rule is unconstrained. Each filter may only be used once per channel.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `channelId` | body | string | yes | ID of the channel. |
| `name` | body | string | no | New name. Must stay unique within the project. |
| `description` | body | string | no | New description. |
| `lifecycleId` | body | string | no | Lifecycle to bind. |
| `isDefault` | body | boolean | no | Promote to default channel. |
| `versionRange` | body | string | no | Version range a release version must satisfy. Omit to leave unchanged, send `""` to clear. |
| `versionTagRegex` | body | string | no | Regular expression the release version's prerelease tag must match. Omit to leave unchanged, send `""` to clear. |
| `versionDefaultTag` | body | string | no | Prerelease tag appended to auto-suggested versions. Omit to leave unchanged, send `""` to clear. |
| `packageRules` | body | array<object> | no | Replaces the channel's package rules wholesale. Omit to leave them unchanged, send `[]` to remove all of them. Element fields are the same as on create. |

## Errors

| Status | Meaning |
|---|---|
| 400 | Invalid `channelId`, or a duplicate channel name. |
| 400 | Validation failure. Rule fields are validated on save: an unparseable `versionRange`, an invalid `versionTagRegex` (backreferences and lookarounds are rejected), a `versionDefaultTag` which its own `versionTagRegex` would not match, a blank `packageFilter`, or two package rules sharing the same filter. |
| 401 | Missing or invalid Basic auth credentials, or the service account lacks the required role. |

Example request:

```
PUT /api/project/channel
Authorization: Basic <base64(serviceAccountId:apiKey)>
Content-Type: application/json

{
  "channelId": "ch_2",
  "versionRange": "[3.0,4.0)",
  "packageRules": [
    {
      "packageFilter": "*",
      "versionTagRegex": "^$"
    }
  ]
}
```

Example response:

```
{}
```

