resend-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseResend CLI
Resend CLI
Agent Protocol
Agent协议
The CLI auto-detects non-TTY environments and outputs JSON — no flag needed.
--jsonRules for agents:
- Supply ALL required flags. The CLI will NOT prompt when stdin is not a TTY.
- Pass (or
--quiet) to suppress spinners and status messages.-q - Exit = success,
0= error.1 - Error JSON goes to stderr, success JSON goes to stdout:
json
{"error":{"message":"...","code":"..."}} - Use or
--api-keyenv var. Never rely on interactive login.RESEND_API_KEY - All /
deletecommands requirermin non-interactive mode.--yes
CLI会自动检测非TTY环境并输出JSON——无需使用标志。
--jsonAgent规则:
- 提供所有必填标志。当标准输入不是TTY时,CLI不会进行提示。
- 传递(或
--quiet)以抑制加载动画和状态消息。-q - 退出码表示成功,
0表示错误。1 - 错误JSON输出到stderr,成功JSON输出到stdout:
json
{"error":{"message":"...","code":"..."}} - 使用或
--api-key环境变量。切勿依赖交互式登录。RESEND_API_KEY - 所有/
delete命令在非交互式模式下需要添加rm标志。--yes
Authentication
认证
Auth resolves: flag > env > config file (). Use or for multi-profile.
--api-keyRESEND_API_KEYresend login --key--profileRESEND_PROFILE认证优先级:标志 > 环境变量 > 配置文件()。使用或进行多配置文件管理。
--api-keyRESEND_API_KEYresend login --key--profileRESEND_PROFILEGlobal Flags
全局标志
| Flag | Description |
|---|---|
| Override API key for this invocation |
| Select stored profile |
| Force JSON output (auto in non-TTY) |
| Suppress spinners/status (implies |
| 标志 | 描述 |
|---|---|
| 覆盖本次调用使用的API密钥 |
| 选择已存储的配置文件 |
| 强制输出JSON(非TTY环境下自动启用) |
| 抑制加载动画/状态消息(隐含 |
Available Commands
可用命令
| Command Group | What it does |
|---|---|
| send, get, list, batch, cancel, update |
| list, get, attachments, forward, listen |
| create, verify, update, delete, list |
| create, list, delete |
| create, send, update, delete, list |
| create, update, delete, segments, topics |
| create, update, delete, list |
| create, get, list, delete |
| create, publish, duplicate, delete, list |
| create, update, delete, list |
| create, update, listen, delete, list |
| login, logout, switch, rename, remove |
| Utility commands |
Read the matching reference file for detailed flags and output shapes.
| 命令组 | 功能 |
|---|---|
| 发送、获取、列出、批量发送、取消、更新 |
| 列出、获取、查看附件、转发、监听 |
| 创建、验证、更新、删除、列出 |
| 创建、列出、删除 |
| 创建、发送、更新、删除、列出 |
| 创建、更新、删除、管理分段、管理主题 |
| 创建、更新、删除、列出 |
| 创建、获取、列出、删除 |
| 创建、发布、复制、删除、列出 |
| 创建、更新、删除、列出 |
| 创建、更新、监听、删除、列出 |
| 登录、登出、切换、重命名、移除配置文件 |
| 实用工具命令 |
查看对应的参考文件以获取详细的标志说明和输出格式。
Common Mistakes
常见错误
| # | Mistake | Fix |
|---|---|---|
| 1 | Forgetting | All |
| 2 | Not saving webhook | |
| 3 | Omitting | Without |
| 4 | Using | Batch sending does not support |
| 5 | Expecting | List returns summaries only — use |
| 6 | Sending a dashboard-created broadcast via CLI | Only API-created broadcasts can be sent with |
| 7 | Passing | |
| 序号 | 错误操作 | 修复方法 |
|---|---|---|
| 1 | 删除命令忘记添加 | 在非交互式模式下,所有 |
| 2 | 未保存webhook的 | |
| 3 | 在CI环境中未使用 | 如果不添加 |
| 4 | 批量发送时使用 | 批量发送不支持 |
| 5 | 期望 | 列表命令仅返回摘要信息——如需完整的 |
| 6 | 通过CLI发送在控制台创建的广播 | 只有通过API创建的广播才能使用 |
| 7 | 在 | |
Common Patterns
常见使用示例
Send an email:
bash
resend emails send --from "you@domain.com" --to user@example.com --subject "Hello" --text "Body"Domain setup flow:
bash
resend domains create --name example.com --region us-east-1发送邮件:
bash
resend emails send --from "you@domain.com" --to user@example.com --subject "Hello" --text "Body"域名配置流程:
bash
resend domains create --name example.com --region us-east-1Configure DNS records from output, then:
根据输出配置DNS记录,然后执行:
resend domains verify <domain-id>
resend domains get <domain-id> # check status
**Create and send a broadcast:**
```bash
resend broadcasts create --from "news@domain.com" --subject "Update" --segment-id <id> --html "<h1>Hi</h1>" --sendCI/CD (no login needed):
bash
RESEND_API_KEY=re_xxx resend emails send --from ... --to ... --subject ... --text ...Check environment health:
bash
resend doctor -qresend domains verify <domain-id>
resend domains get <domain-id> # 检查状态
**创建并发送广播:**
```bash
resend broadcasts create --from "news@domain.com" --subject "Update" --segment-id <id> --html "<h1>Hi</h1>" --sendCI/CD环境使用(无需登录):
bash
RESEND_API_KEY=re_xxx resend emails send --from ... --to ... --subject ... --text ...检查环境健康状态:
bash
resend doctor -qWhen to Load References
何时查看参考文档
- Sending or reading emails → references/emails.md
- Setting up or verifying a domain → references/domains.md
- Managing API keys → references/api-keys.md
- Creating or sending broadcasts → references/broadcasts.md
- Managing contacts, segments, or topics → references/contacts.md, references/segments.md, references/topics.md
- Defining contact properties → references/contact-properties.md
- Working with templates → references/templates.md
- Setting up webhooks or listening for events → references/webhooks.md
- Auth, profiles, or health checks → references/auth.md
- Multi-step recipes (setup, CI/CD, broadcast workflow) → references/workflows.md
- Command failed with an error → references/error-codes.md
- Resend SDK integration (Node.js, Python, Go, etc.) → Install the skill
resend - AI agent email inbox → Install the skill
agent-email-inbox
- 发送或查看邮件 → references/emails.md
- 配置或验证域名 → references/domains.md
- 管理API密钥 → references/api-keys.md
- 创建或发送广播 → references/broadcasts.md
- 管理联系人、分段或主题 → references/contacts.md, references/segments.md, references/topics.md
- 定义联系人属性 → references/contact-properties.md
- 使用模板 → references/templates.md
- 配置webhook或监听事件 → references/webhooks.md
- 认证、配置文件或健康检查 → references/auth.md
- 多步骤流程(配置、CI/CD、广播工作流) → references/workflows.md
- 命令执行报错 → references/error-codes.md
- Resend SDK集成(Node.js、Python、Go等) → 安装技能
resend - AI Agent邮箱收件箱 → 安装技能
agent-email-inbox