> ## Documentation Index
> Fetch the complete documentation index at: https://onecli.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Channels API: Connect Hosted Agents to Slack

> Connect hosted agents to Slack, decide who can reach them, approve their actions, and manage who they may message with the OneCLI API.

Channels control where a hosted agent is reachable, such as Slack, and who may talk to it there. They also cover the other direction: which people and agents the agent may message on its own, and the approvals it asks for before it acts.

Use these endpoints to attach a channel, settle reach for spaces and people, and review approvals from code. For the Slack setup walkthrough, see [Slack](https://onecli.sh/docs/integrations/slack.md).

## Related guides

* [Slack integration](https://onecli.sh/docs/integrations/slack.md)
* [Rules: control what agents can do](https://onecli.sh/docs/guides/rules.md)

## Endpoints

| Endpoint | Method and path | What it does |
| - | - | - |
| [Get an agent's channels](https://onecli.sh/docs/api-reference/channels/get-an-agents-channels.md) | `GET /agents/{agentId}/channels` | Get where a hosted agent is reachable, who may reach it there, and the health of each channel connection. |
| [Get the setup material for a channel](https://onecli.sh/docs/api-reference/channels/get-the-setup-material-for-a-channel.md) | `GET /agents/{agentId}/channels/{provider}/manifest` | Get the setup material to create a channel app by hand, such as the Slack app manifest for your chosen transport. |
| [Attach a channel (guided)](https://onecli.sh/docs/api-reference/channels/attach-a-channel-guided.md) | `POST /agents/{agentId}/channels/{provider}` | Connect a hosted agent to a channel such as Slack. |
| [Detach a channel](https://onecli.sh/docs/api-reference/channels/detach-a-channel.md) | `DELETE /agents/{agentId}/channels/{provider}` | Remove a hosted agent from a channel, with its reach decisions and tokens. |
| [Complete a channel attach with pasted tokens](https://onecli.sh/docs/api-reference/channels/complete-a-channel-attach-with-pasted-tokens.md) | `POST /agents/{agentId}/channels/{provider}/complete` | Finish connecting a channel by pasting the provider app's tokens, for socket transport or a manual setup. |
| [Decide who may reach the agent in a space](https://onecli.sh/docs/api-reference/channels/decide-who-may-reach-the-agent-in-a-space.md) | `PUT /agents/{agentId}/channels/{provider}/reach/{externalRef}` | Decide who may talk to a hosted agent in a channel space: everyone, OneCLI members only, or no one. |
| [Forget a space](https://onecli.sh/docs/api-reference/channels/forget-a-space.md) | `DELETE /agents/{agentId}/channels/{provider}/reach/{externalRef}` | Clear the reach decision for a channel space so the next message from a stranger there asks for approval again. |
| [Decide whether a person may reach the agent](https://onecli.sh/docs/api-reference/channels/decide-whether-a-person-may-reach-the-agent.md) | `PUT /agents/{agentId}/channels/{provider}/reach/people/{externalRef}` | Approve or block one person from sending direct messages to a hosted agent on a channel. |
| [Forget a person](https://onecli.sh/docs/api-reference/channels/forget-a-person.md) | `DELETE /agents/{agentId}/channels/{provider}/reach/people/{externalRef}` | Clear a person's reach decision for a hosted agent so their next direct message asks for approval again. |
| [List an agent's action approvals](https://onecli.sh/docs/api-reference/channels/list-an-agents-action-approvals.md) | `GET /agents/{agentId}/approvals` | List the approvals a hosted agent requested before taking an action, such as sending a message, newest first. |
| [Decide an action approval](https://onecli.sh/docs/api-reference/channels/decide-an-action-approval.md) | `POST /agents/{agentId}/approvals/{approvalId}/decision` | Approve an agent's action once, approve it always, or reject it with a reason the hosted agent can see. |
| [List an agent's contacts](https://onecli.sh/docs/api-reference/channels/list-an-agents-contacts.md) | `GET /agents/{agentId}/contacts` | List a hosted agent's outbound contacts and whether it may message each one without asking first. |
| [Set a contact's policy](https://onecli.sh/docs/api-reference/channels/set-a-contacts-policy.md) | `PUT /agents/{agentId}/contacts/{contactId}` | Allow, block, or require approval for a hosted agent to message a contact on its own initiative. |
| [Remove a contact](https://onecli.sh/docs/api-reference/channels/remove-a-contact.md) | `DELETE /agents/{agentId}/contacts/{contactId}` | Remove a contact from a hosted agent's address book so messaging them goes back to asking for approval. |
| [List an agent's peers](https://onecli.sh/docs/api-reference/channels/list-an-agents-peers.md) | `GET /agents/{agentId}/links` | List the other hosted agents this agent may message, with both sides' decisions and their shared conversation. |
| [Set this agent's side of a peer link](https://onecli.sh/docs/api-reference/channels/set-this-agents-side-of-a-peer-link.md) | `PUT /agents/{agentId}/links/{peerAgentId}` | Allow, block, or require approval for a hosted agent to message another agent in the workspace. |
| [Forget a peer](https://onecli.sh/docs/api-reference/channels/forget-a-peer.md) | `DELETE /agents/{agentId}/links/{peerAgentId}` | Remove a peer relationship from one hosted agent's side, with its pair conversation and pending approvals. |
| [Resume a paused pair conversation](https://onecli.sh/docs/api-reference/channels/resume-a-paused-pair-conversation.md) | `POST /agents/{agentId}/links/{peerAgentId}/resume` | Let two hosted agents keep talking after their conversation hit its turn cap. |

## Next steps

* [API overview](https://onecli.sh/docs/api-reference.md): base URLs, authentication, and pagination
* [Errors](https://onecli.sh/docs/api-reference/errors.md): status codes and the error format
* [Editions](https://onecli.sh/docs/api-reference/editions.md): which endpoints each edition serves


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.