resend-cli 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,177 @@
1
+ # emails
2
+
3
+ Detailed flag specifications for `resend emails` commands.
4
+
5
+ ---
6
+
7
+ ## emails send
8
+
9
+ Send an email via the Resend API.
10
+
11
+ | Flag | Type | Required | Description |
12
+ |------|------|----------|-------------|
13
+ | `--from <address>` | string | Yes | Sender address (must be on a verified domain) |
14
+ | `--to <addresses...>` | string[] | Yes | Recipient(s), space-separated |
15
+ | `--subject <subject>` | string | Yes | Email subject line |
16
+ | `--text <text>` | string | One of text/html/html-file | Plain-text body |
17
+ | `--html <html>` | string | One of text/html/html-file | HTML body |
18
+ | `--html-file <path>` | string | One of text/html/html-file | Path to HTML file |
19
+ | `--cc <addresses...>` | string[] | No | CC recipients |
20
+ | `--bcc <addresses...>` | string[] | No | BCC recipients |
21
+ | `--reply-to <address>` | string | No | Reply-to address |
22
+ | `--scheduled-at <datetime>` | string | No | Schedule for later (ISO 8601) |
23
+ | `--attachment <paths...>` | string[] | No | File paths to attach |
24
+ | `--headers <key=value...>` | string[] | No | Custom headers |
25
+ | `--tags <name=value...>` | string[] | No | Email tags |
26
+ | `--idempotency-key <key>` | string | No | Deduplicate request |
27
+
28
+ **Output:** `{"id":"<uuid>"}`
29
+
30
+ ---
31
+
32
+ ## emails get
33
+
34
+ Retrieve a sent email by ID.
35
+
36
+ **Argument:** `<id>` — Email UUID
37
+
38
+ **Output:**
39
+ ```json
40
+ {
41
+ "object": "email",
42
+ "id": "<uuid>",
43
+ "from": "you@domain.com",
44
+ "to": ["user@example.com"],
45
+ "subject": "Hello",
46
+ "last_event": "delivered",
47
+ "created_at": "<iso-date>",
48
+ "scheduled_at": null
49
+ }
50
+ ```
51
+
52
+ ---
53
+
54
+ ## emails list
55
+
56
+ List sent emails.
57
+
58
+ | Flag | Type | Default | Description |
59
+ |------|------|---------|-------------|
60
+ | `--limit <n>` | number | 10 | Max results (1-100) |
61
+ | `--after <cursor>` | string | — | Forward pagination cursor |
62
+ | `--before <cursor>` | string | — | Backward pagination cursor |
63
+
64
+ **Output:** `{"object":"list","data":[...],"has_more":bool}`
65
+
66
+ ---
67
+
68
+ ## emails batch
69
+
70
+ Send up to 100 emails in a single request.
71
+
72
+ | Flag | Type | Required | Description |
73
+ |------|------|----------|-------------|
74
+ | `--file <path>` | string | Yes (non-interactive) | Path to JSON file with email array |
75
+ | `--idempotency-key <key>` | string | No | Deduplicate batch |
76
+ | `--batch-validation <mode>` | string | No | `strict` (fail all) or `permissive` (partial success) |
77
+
78
+ **JSON file format:**
79
+ ```json
80
+ [
81
+ {"from":"a@domain.com","to":["b@example.com"],"subject":"Hi","text":"Body"},
82
+ {"from":"a@domain.com","to":["c@example.com"],"subject":"Hi","html":"<b>Body</b>"}
83
+ ]
84
+ ```
85
+
86
+ **Output (success):** `[{"id":"..."},{"id":"..."}]`
87
+ **Output (permissive with errors):** `{"data":[{"id":"..."}],"errors":[{"index":1,"message":"..."}]}`
88
+
89
+ **Constraints:** Max 100 emails. Attachments and `scheduled_at` not supported per-email.
90
+
91
+ ---
92
+
93
+ ## emails cancel
94
+
95
+ Cancel a scheduled email.
96
+
97
+ **Argument:** `<id>` — Email UUID
98
+
99
+ **Output:** `{"object":"email","id":"..."}`
100
+
101
+ ---
102
+
103
+ ## emails update
104
+
105
+ Update a scheduled email.
106
+
107
+ **Argument:** `<id>` — Email UUID
108
+
109
+ | Flag | Type | Required | Description |
110
+ |------|------|----------|-------------|
111
+ | `--scheduled-at <datetime>` | string | Yes | New schedule (ISO 8601) |
112
+
113
+ **Output:** `{"object":"email","id":"..."}`
114
+
115
+ ---
116
+
117
+ ## emails receiving list
118
+
119
+ List received (inbound) emails. Requires domain receiving enabled.
120
+
121
+ | Flag | Type | Default | Description |
122
+ |------|------|---------|-------------|
123
+ | `--limit <n>` | number | 10 | Max results (1-100) |
124
+ | `--after <cursor>` | string | — | Forward pagination |
125
+ | `--before <cursor>` | string | — | Backward pagination |
126
+
127
+ ---
128
+
129
+ ## emails receiving get
130
+
131
+ **Argument:** `<id>` — Received email UUID
132
+
133
+ Returns full email with html, text, headers, `raw.download_url`, and `attachments[]`.
134
+
135
+ ---
136
+
137
+ ## emails receiving attachments
138
+
139
+ **Argument:** `<emailId>` — Received email UUID
140
+
141
+ Lists attachments with `id`, `filename`, `size`, `content_type`, `download_url`, `expires_at`.
142
+
143
+ ---
144
+
145
+ ## emails receiving attachment
146
+
147
+ **Arguments:** `<emailId>` `<attachmentId>`
148
+
149
+ Returns single attachment object with `download_url`.
150
+
151
+ ---
152
+
153
+ ## emails receiving forward
154
+
155
+ **Argument:** `<id>` — Received email UUID
156
+
157
+ | Flag | Type | Required | Description |
158
+ |------|------|----------|-------------|
159
+ | `--to <addresses...>` | string[] | Yes | Forward recipients |
160
+ | `--from <address>` | string | Yes | Sender address |
161
+
162
+ **Output:** `{"id":"..."}`
163
+
164
+ ---
165
+
166
+ ## emails receiving listen
167
+
168
+ Poll for new inbound emails and display them as they arrive. Long-running command; Ctrl+C exits cleanly.
169
+
170
+ | Flag | Type | Default | Description |
171
+ |------|------|---------|-------------|
172
+ | `--interval <seconds>` | number | 5 | Polling interval in seconds (minimum 2) |
173
+
174
+ **Behavior:**
175
+ - Interactive: one-line-per-email display (timestamp, from, to, subject, id)
176
+ - Piped / `--json`: NDJSON (one JSON object per line)
177
+ - Exits after 5 consecutive API failures
@@ -0,0 +1,54 @@
1
+ # Error Codes
2
+
3
+ All errors exit with code `1` and output JSON to **stderr**:
4
+
5
+ ```json
6
+ {"error":{"message":"Human-readable description","code":"error_code"}}
7
+ ```
8
+
9
+ ## Authentication Errors
10
+
11
+ | Code | Cause | Resolution |
12
+ |------|-------|------------|
13
+ | `auth_error` | No API key found from any source | Set `RESEND_API_KEY` env, pass `--api-key`, or run `resend login --key re_xxx` |
14
+ | `missing_key` | `login` called non-interactively without `--key` | Pass `--key re_xxx` |
15
+ | `invalid_key_format` | API key does not start with `re_` | Use a valid Resend API key starting with `re_` |
16
+ | `validation_failed` | Resend API rejected the key during login | Verify the key exists and is active at resend.com/api-keys |
17
+
18
+ ## Email Errors
19
+
20
+ | Code | Cause | Resolution |
21
+ |------|-------|------------|
22
+ | `missing_body` | None of `--text`, `--html`, or `--html-file` provided | Provide at least one body flag |
23
+ | `file_read_error` | Could not read file from `--html-file` path | Check file path exists and is readable |
24
+ | `send_error` | Resend API rejected the send request | Check from address is on a verified domain; check recipient is valid |
25
+
26
+ ## Domain Errors
27
+
28
+ | Code | Cause | Resolution |
29
+ |------|-------|------------|
30
+ | `domain_error` | Domain creation, verification, or update failed | Check domain name is valid; check DNS records are configured |
31
+
32
+ ## General Errors
33
+
34
+ | Code | Cause | Resolution |
35
+ |------|-------|------------|
36
+ | `unexpected_error` | Unhandled exception | Check CLI version with `resend update`; report at github.com/resend/resend-cli/issues |
37
+ | `unknown` | Error without a specific code | Inspect the `message` field for details |
38
+
39
+ ## Troubleshooting
40
+
41
+ ### "No API key found" in CI
42
+ Ensure `RESEND_API_KEY` is set in the environment. The CLI does not prompt in non-TTY mode.
43
+
44
+ ### "Missing required flags" errors
45
+ In non-interactive mode (CI, piped, agent), ALL required flags must be provided. The CLI will not prompt.
46
+
47
+ ### Deletion commands fail without `--yes`
48
+ All `delete`/`rm` subcommands require `--yes` in non-interactive mode to prevent accidental deletion.
49
+
50
+ ### API rate limits
51
+ The Resend API has rate limits. If you hit them, the error message will indicate rate limiting. Add delays between batch operations.
52
+
53
+ ### Scheduled email errors
54
+ `--scheduled-at` must be a valid ISO 8601 datetime. The scheduled time must be in the future.
@@ -0,0 +1,39 @@
1
+ # segments
2
+
3
+ Detailed flag specifications for `resend segments` commands.
4
+
5
+ ---
6
+
7
+ ## segments list
8
+
9
+ | Flag | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `--limit <n>` | number | 10 | Max results (1-100) |
12
+ | `--after <cursor>` | string | — | Forward pagination |
13
+ | `--before <cursor>` | string | — | Backward pagination |
14
+
15
+ ---
16
+
17
+ ## segments create
18
+
19
+ | Flag | Type | Required | Description |
20
+ |------|------|----------|-------------|
21
+ | `--name <name>` | string | Yes (non-interactive) | Segment name |
22
+
23
+ ---
24
+
25
+ ## segments get
26
+
27
+ **Argument:** `<id>` — Segment UUID
28
+
29
+ ---
30
+
31
+ ## segments delete
32
+
33
+ **Argument:** `<id>` — Segment UUID
34
+
35
+ | Flag | Type | Required | Description |
36
+ |------|------|----------|-------------|
37
+ | `--yes` | boolean | Yes (non-interactive) | Skip confirmation |
38
+
39
+ Deleting a segment does NOT delete its contacts.
@@ -0,0 +1,67 @@
1
+ # templates
2
+
3
+ Detailed flag specifications for `resend templates` commands.
4
+
5
+ ---
6
+
7
+ ## templates list
8
+
9
+ | Flag | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `--limit <n>` | number | 10 | Max results (1-100) |
12
+ | `--after <cursor>` | string | — | Forward pagination |
13
+ | `--before <cursor>` | string | — | Backward pagination |
14
+
15
+ ---
16
+
17
+ ## templates create
18
+
19
+ | Flag | Type | Required | Description |
20
+ |------|------|----------|-------------|
21
+ | `--name <name>` | string | Yes | Template name |
22
+ | `--html <html>` | string | One of html/html-file | HTML body with `{{{VAR_NAME}}}` placeholders |
23
+ | `--html-file <path>` | string | One of html/html-file | Path to HTML file |
24
+ | `--subject <subject>` | string | No | Email subject |
25
+ | `--text <text>` | string | No | Plain-text body |
26
+ | `--from <address>` | string | No | Sender address |
27
+ | `--reply-to <address>` | string | No | Reply-to address |
28
+ | `--alias <alias>` | string | No | Lookup alias |
29
+ | `--var <var...>` | string[] | No | Variables: `KEY:type` or `KEY:type:fallback` |
30
+
31
+ Variable types: `string`, `number`
32
+
33
+ ---
34
+
35
+ ## templates get
36
+
37
+ **Argument:** `<id|alias>` — Template ID or alias
38
+
39
+ ---
40
+
41
+ ## templates update
42
+
43
+ **Argument:** `<id|alias>` — Template ID or alias
44
+
45
+ Same optional flags as `create`. At least one required.
46
+
47
+ ---
48
+
49
+ ## templates publish
50
+
51
+ **Argument:** `<id|alias>` — Promotes draft to published.
52
+
53
+ ---
54
+
55
+ ## templates duplicate
56
+
57
+ **Argument:** `<id|alias>` — Creates a copy as draft.
58
+
59
+ ---
60
+
61
+ ## templates delete
62
+
63
+ **Argument:** `<id|alias>`
64
+
65
+ | Flag | Type | Required | Description |
66
+ |------|------|----------|-------------|
67
+ | `--yes` | boolean | Yes (non-interactive) | Skip confirmation |
@@ -0,0 +1,50 @@
1
+ # topics
2
+
3
+ Detailed flag specifications for `resend topics` commands.
4
+
5
+ ---
6
+
7
+ ## topics list
8
+
9
+ Lists all topics. No pagination flags.
10
+
11
+ ---
12
+
13
+ ## topics create
14
+
15
+ | Flag | Type | Required | Description |
16
+ |------|------|----------|-------------|
17
+ | `--name <name>` | string | Yes (non-interactive) | Topic name |
18
+ | `--description <desc>` | string | No | Description |
19
+ | `--default-subscription <mode>` | string | No | `opt_in` (default) \| `opt_out` |
20
+
21
+ ---
22
+
23
+ ## topics get
24
+
25
+ **Argument:** `<id>` — Topic UUID
26
+
27
+ ---
28
+
29
+ ## topics update
30
+
31
+ **Argument:** `<id>` — Topic UUID
32
+
33
+ | Flag | Type | Description |
34
+ |------|------|-------------|
35
+ | `--name <name>` | string | New name |
36
+ | `--description <desc>` | string | New description |
37
+
38
+ At least one of `--name` or `--description` is required — otherwise the CLI errors with `no_changes`.
39
+
40
+ `default_subscription` cannot be changed after creation.
41
+
42
+ ---
43
+
44
+ ## topics delete
45
+
46
+ **Argument:** `<id>` — Topic UUID
47
+
48
+ | Flag | Type | Required | Description |
49
+ |------|------|----------|-------------|
50
+ | `--yes` | boolean | Yes (non-interactive) | Skip confirmation |
@@ -0,0 +1,79 @@
1
+ # webhooks
2
+
3
+ Detailed flag specifications for `resend webhooks` commands.
4
+
5
+ ---
6
+
7
+ ## webhooks list
8
+
9
+ | Flag | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `--limit <n>` | number | 10 | Max results (1-100) |
12
+ | `--after <cursor>` | string | — | Forward pagination |
13
+ | `--before <cursor>` | string | — | Backward pagination |
14
+
15
+ ---
16
+
17
+ ## webhooks create
18
+
19
+ | Flag | Type | Required | Description |
20
+ |------|------|----------|-------------|
21
+ | `--endpoint <url>` | string | Yes (non-interactive) | HTTPS webhook URL |
22
+ | `--events <events...>` | string[] | Yes (non-interactive) | Event types or `all` |
23
+
24
+ **All 17 events:**
25
+ - Email: `email.sent`, `email.delivered`, `email.delivery_delayed`, `email.bounced`, `email.complained`, `email.opened`, `email.clicked`, `email.failed`, `email.scheduled`, `email.suppressed`, `email.received`
26
+ - Contact: `contact.created`, `contact.updated`, `contact.deleted`
27
+ - Domain: `domain.created`, `domain.updated`, `domain.deleted`
28
+
29
+ **Output includes `signing_secret`** — shown once only. Save immediately.
30
+
31
+ ---
32
+
33
+ ## webhooks get
34
+
35
+ **Argument:** `<id>` — Webhook ID
36
+
37
+ **Note:** `signing_secret` is NOT returned by get (only at creation).
38
+
39
+ ---
40
+
41
+ ## webhooks update
42
+
43
+ **Argument:** `<id>` — Webhook ID
44
+
45
+ | Flag | Type | Description |
46
+ |------|------|-------------|
47
+ | `--endpoint <url>` | string | New HTTPS URL |
48
+ | `--events <events...>` | string[] | Replace event list (not additive) |
49
+ | `--status <status>` | string | `enabled` \| `disabled` |
50
+
51
+ ---
52
+
53
+ ## webhooks delete
54
+
55
+ **Argument:** `<id>` — Webhook ID
56
+
57
+ | Flag | Type | Required | Description |
58
+ |------|------|----------|-------------|
59
+ | `--yes` | boolean | Yes (non-interactive) | Skip confirmation |
60
+
61
+ ---
62
+
63
+ ## webhooks listen
64
+
65
+ Start a local server that receives Resend webhook events in real time via a public tunnel URL.
66
+
67
+ | Flag | Type | Default | Description |
68
+ |------|------|---------|-------------|
69
+ | `--url <url>` | string | — | Public tunnel URL for receiving webhooks (required in non-interactive) |
70
+ | `--forward-to <url>` | string | — | Forward payloads to this local URL (preserves Svix headers) |
71
+ | `--events <events...>` | string[] | all | Event types to listen for |
72
+ | `--port <port>` | number | 4318 | Local server port |
73
+
74
+ **Behavior:**
75
+ 1. Starts a local HTTP server on `--port`
76
+ 2. Registers a temporary Resend webhook pointing at `--url`
77
+ 3. Displays incoming events in the terminal
78
+ 4. Optionally forwards payloads to `--forward-to` with original Svix headers
79
+ 5. Deletes the temporary webhook on exit (Ctrl+C)