# Update a channel

`PATCH /v1/channels/{channel_id}`

Requires role admin or higher.

## Authentication

A session token: `Authorization: Bearer <session token>`, or the session cookie in the browser. Requires role `admin` or higher.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `channel_id` | path | string | yes |  |

## Request body

`application/json`

```json
{
  "additionalProperties": false,
  "minProperties": 1,
  "properties": {
    "enabled": {
      "type": "boolean"
    },
    "name": {
      "maxLength": 100,
      "minLength": 1,
      "pattern": "^(?=[\\s\\S]*\\S)[^\\u0000-\\u001F\\u007F]+$",
      "type": "string"
    },
    "url": {
      "maxLength": 2048,
      "minLength": 1,
      "type": "string"
    }
  },
  "type": "object"
}
```

## Responses

### 200

A notification channel.

`application/json`

```json
{
  "anyOf": [
    {
      "additionalProperties": false,
      "description": "A channel that emails one member.",
      "properties": {
        "created_at": {
          "format": "date-time",
          "type": "string"
        },
        "email": {
          "description": "The member's current address.",
          "type": "string"
        },
        "enabled": {
          "type": "boolean"
        },
        "health": {
          "anyOf": [
            {
              "enum": [
                "ok"
              ],
              "type": "string"
            },
            {
              "enum": [
                "failing"
              ],
              "type": "string"
            }
          ],
          "description": "failing after 3 consecutive failed deliveries, until one succeeds."
        },
        "id": {
          "pattern": "^chn_[0-7][0-9a-hjkmnp-tv-z]{25}$",
          "type": "string"
        },
        "member_id": {
          "pattern": "^mem_[0-7][0-9a-hjkmnp-tv-z]{25}$",
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "project_id": {
          "pattern": "^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$",
          "type": "string"
        },
        "type": {
          "enum": [
            "email"
          ],
          "type": "string"
        },
        "updated_at": {
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "id",
        "project_id",
        "name",
        "enabled",
        "health",
        "created_at",
        "updated_at",
        "type",
        "member_id",
        "email"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "description": "A channel that posts signed requests to a URL.",
      "properties": {
        "created_at": {
          "format": "date-time",
          "type": "string"
        },
        "enabled": {
          "type": "boolean"
        },
        "health": {
          "anyOf": [
            {
              "enum": [
                "ok"
              ],
              "type": "string"
            },
            {
              "enum": [
                "failing"
              ],
              "type": "string"
            }
          ],
          "description": "failing after 3 consecutive failed deliveries, until one succeeds."
        },
        "id": {
          "pattern": "^chn_[0-7][0-9a-hjkmnp-tv-z]{25}$",
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "project_id": {
          "pattern": "^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$",
          "type": "string"
        },
        "type": {
          "enum": [
            "webhook"
          ],
          "type": "string"
        },
        "updated_at": {
          "format": "date-time",
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "project_id",
        "name",
        "enabled",
        "health",
        "created_at",
        "updated_at",
        "type",
        "url"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "description": "A channel that posts to a Slack incoming webhook.",
      "properties": {
        "created_at": {
          "format": "date-time",
          "type": "string"
        },
        "enabled": {
          "type": "boolean"
        },
        "health": {
          "anyOf": [
            {
              "enum": [
                "ok"
              ],
              "type": "string"
            },
            {
              "enum": [
                "failing"
              ],
              "type": "string"
            }
          ],
          "description": "failing after 3 consecutive failed deliveries, until one succeeds."
        },
        "id": {
          "pattern": "^chn_[0-7][0-9a-hjkmnp-tv-z]{25}$",
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "project_id": {
          "pattern": "^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$",
          "type": "string"
        },
        "type": {
          "enum": [
            "slack"
          ],
          "type": "string"
        },
        "updated_at": {
          "format": "date-time",
          "type": "string"
        },
        "url_hint": {
          "description": "Identifies the webhook without revealing it; the URL itself is never returned.",
          "type": "string"
        }
      },
      "required": [
        "id",
        "project_id",
        "name",
        "enabled",
        "health",
        "created_at",
        "updated_at",
        "type",
        "url_hint"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "description": "A channel that posts to a Discord channel webhook.",
      "properties": {
        "created_at": {
          "format": "date-time",
          "type": "string"
        },
        "enabled": {
          "type": "boolean"
        },
        "health": {
          "anyOf": [
            {
              "enum": [
                "ok"
              ],
              "type": "string"
            },
            {
              "enum": [
                "failing"
              ],
              "type": "string"
            }
          ],
          "description": "failing after 3 consecutive failed deliveries, until one succeeds."
        },
        "id": {
          "pattern": "^chn_[0-7][0-9a-hjkmnp-tv-z]{25}$",
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "project_id": {
          "pattern": "^prj_[0-7][0-9a-hjkmnp-tv-z]{25}$",
          "type": "string"
        },
        "type": {
          "enum": [
            "discord"
          ],
          "type": "string"
        },
        "updated_at": {
          "format": "date-time",
          "type": "string"
        },
        "url_hint": {
          "description": "Identifies the webhook without revealing it; the URL itself is never returned.",
          "type": "string"
        }
      },
      "required": [
        "id",
        "project_id",
        "name",
        "enabled",
        "health",
        "created_at",
        "updated_at",
        "type",
        "url_hint"
      ],
      "type": "object"
    }
  ],
  "description": "A notification channel."
}
```

### 401

unauthorized: no valid session, or the email is not verified.

Problem type: [unauthorized](https://docs.dlogify.com/errors/unauthorized.md).

### 403

channel-type-not-allowed: enabling a webhook channel on a plan without webhooks. csrf-origin-rejected: a cookie-authenticated change from an origin outside the web app. forbidden: the action requires the admin role.

Problem type: [channel-type-not-allowed](https://docs.dlogify.com/errors/channel-type-not-allowed.md).

### 404

not-found: the resource does not exist, or the caller is not a member of its organization.

Problem type: [not-found](https://docs.dlogify.com/errors/not-found.md).

### 422

invalid-webhook-url, or validation-failed (for example url on an email channel). validation-failed: the request does not match the schema.

A problem document: see [Errors](https://docs.dlogify.com/errors.md).

### 429

rate-limited: per-user management request limit.

Problem type: [rate-limited](https://docs.dlogify.com/errors/rate-limited.md).

## Example

```bash
curl -X PATCH "https://api.dlogify.com/v1/channels/{channel_id}" \
  -H "Authorization: Bearer $DLOGIFY_SESSION" \
  -H "Content-Type: application/json" \
  --data-binary @body
```

Source: https://docs.dlogify.com/api/channels/updateChannel
