# Agents

> Connect AI agents like Claude Code and ChatGPT to your Broadcast instance for automated email marketing management.

Source: https://sendbroadcast.net/docs/agents

Agents are AI tools (like Claude Code, ChatGPT, or custom scripts) that can interact with your Broadcast instance programmatically. The Agents feature provides a discovery and onboarding layer so these tools can self-configure and operate Broadcast on your behalf.

## Why Use Agents?

Instead of manually navigating the UI for every operation, you can instruct an AI agent to:

- **Manage subscribers:** add, tag, segment, and export contacts
- **Send broadcasts:** draft, review, and send email campaigns
- **Monitor performance:** check open rates, click rates, and delivery stats
- **Manage sequences:** create and configure automated email workflows
- **Troubleshoot:** diagnose delivery issues and check email server status

## Three Ways to Connect

### 1. CLI (`broadcast` command)

A lightweight command-line tool that wraps the Broadcast API. Install it with a single `curl` command, authenticate with your API token, and start managing Broadcast from your terminal or AI agent.

Best for: Terminal-based workflows, shell scripts, and agents that can execute commands.

[Learn more about the CLI →](https://sendbroadcast.net/docs/agents-cli)

### 2. REST API (Agent Endpoints)

Broadcast provides dedicated API endpoints for agent discovery and onboarding:

- **`GET /api/v1/whoami`:** Identify the current token and its permissions
- **`GET /api/v1/status`:** Check channel health and readiness
- **`GET /api/v1/prime`:** Get a full capabilities manifest with available endpoints

These complement the existing 50+ API endpoints for subscribers, broadcasts, sequences, and more.

[View the Agents API Reference →](https://sendbroadcast.net/docs/api-agents)

### 3. MCP Server (Claude Code and other MCP clients)

A Model Context Protocol server built into Broadcast at `/api/mcp`. Point Claude Code or another MCP client at it with an API token, and every API operation that token allows becomes a native tool. Nothing to install. Requires Broadcast 2.35.0 or later.

Best for: Claude Code and other MCP clients that should manage Broadcast directly, without shell commands.

[Set up the MCP Server →](https://sendbroadcast.net/docs/agents-mcp)

## Quick Start

The fastest way to connect an agent is the **copy-paste introduction**:

1. Go to **Agents** in your Broadcast sidebar
2. Copy the **Introduction Message**
3. Paste it into your AI agent (Claude Code, ChatGPT, etc.)

The introduction message includes your instance URL, API token, permissions, and quick-start commands: everything an agent needs to get started.

## Setup Links

For a more secure onboarding flow, you can generate a **Setup Link**: a time-limited URL that serves agent configuration instructions. Share the link with your agent, and it will self-configure with the correct credentials and permissions.

Setup links expire after 1 hour and can only be accessed 3 times, so they're safe to share in chat conversations.

[Learn more about Setup Links →](https://sendbroadcast.net/docs/agents-setup-links)

## Security

- API tokens control what agents can access: use the principle of least privilege
- Setup links are time-limited and access-limited
- The `whoami` endpoint never exposes the full token value
- The `status` endpoint never exposes sensitive configuration (API keys, SMTP passwords)
- All agent communication happens over HTTPS
