> For the complete documentation index, see [llms.txt](https://docs.dispach.moeenmahmud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dispach.moeenmahmud.com/reference/http/dispach-agent-server/connect-or-disconnect-a-channel-and-set-its-credential.md).

# Connect or disconnect a channel, and set its credential.

```json
{"openapi":"3.1.0","info":{"title":"Dispach agent server","version":"0.1.3"},"servers":[{"url":"http://localhost:7420","description":"Local server. Replace this with the URL of your deployment."}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"An operator key or the configured token."}}},"paths":{"/v1/agents/{id}/channels/{channelId}":{"patch":{"summary":"Connect or disconnect a channel, and set its credential.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"channelId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"400":{"description":"neither `enabled` nor `credential` was sent, or the channel is unknown"},"401":{"description":"No credential, or one this server does not accept."},"404":{"description":"No such agent, or it is switched off."},"409":{"description":"the agent came from an object, so there is no manifest to edit"},"501":{"description":"the host supplied no channel actions"}}}}}}
```
