@cakemail-org/cakemail-cli 1.7.0 → 2.0.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.
Files changed (198) hide show
  1. package/.claude/settings.local.json +12 -0
  2. package/.env.example +40 -0
  3. package/.env.test.example +45 -0
  4. package/CHANGELOG.md +1031 -0
  5. package/README.md +41 -37
  6. package/audit-formats.js +128 -0
  7. package/cakemail.rb +20 -0
  8. package/dist/client.js +1 -1
  9. package/dist/client.js.map +1 -1
  10. package/dist/commands/account.js +1 -1
  11. package/dist/commands/account.js.map +1 -1
  12. package/dist/commands/attributes.js +1 -1
  13. package/dist/commands/attributes.js.map +1 -1
  14. package/dist/commands/campaigns.js +1 -1
  15. package/dist/commands/campaigns.js.map +1 -1
  16. package/dist/commands/contacts.js +1 -1
  17. package/dist/commands/contacts.js.map +1 -1
  18. package/dist/commands/emails.js +1 -1
  19. package/dist/commands/emails.js.map +1 -1
  20. package/dist/commands/interests.js +1 -1
  21. package/dist/commands/interests.js.map +1 -1
  22. package/dist/commands/lists.js +1 -1
  23. package/dist/commands/lists.js.map +1 -1
  24. package/dist/commands/logs.js +1 -1
  25. package/dist/commands/logs.js.map +1 -1
  26. package/dist/commands/reports.js +1 -1
  27. package/dist/commands/reports.js.map +1 -1
  28. package/dist/commands/segments.js +1 -1
  29. package/dist/commands/segments.js.map +1 -1
  30. package/dist/commands/senders.js +1 -1
  31. package/dist/commands/senders.js.map +1 -1
  32. package/dist/commands/suppressed.js +1 -1
  33. package/dist/commands/suppressed.js.map +1 -1
  34. package/dist/commands/tags.js +1 -1
  35. package/dist/commands/tags.js.map +1 -1
  36. package/dist/commands/templates.js +1 -1
  37. package/dist/commands/templates.js.map +1 -1
  38. package/dist/commands/transactional-templates.js +1 -1
  39. package/dist/commands/transactional-templates.js.map +1 -1
  40. package/dist/commands/webhooks.js +1 -1
  41. package/dist/commands/webhooks.js.map +1 -1
  42. package/dist/utils/config.js +2 -2
  43. package/dist/utils/config.js.map +1 -1
  44. package/dist/utils/errors.js +1 -1
  45. package/dist/utils/errors.js.map +1 -1
  46. package/dist/utils/progress.d.ts.map +1 -1
  47. package/dist/utils/progress.js +32 -4
  48. package/dist/utils/progress.js.map +1 -1
  49. package/dist/utils/spinner.d.ts +17 -0
  50. package/dist/utils/spinner.d.ts.map +1 -0
  51. package/dist/utils/spinner.js +43 -0
  52. package/dist/utils/spinner.js.map +1 -0
  53. package/docs/DOCUMENTATION-STANDARD.md +1068 -0
  54. package/docs/README.md +161 -0
  55. package/docs/developer/ARCHITECTURE.md +516 -0
  56. package/docs/developer/AUTH.md +204 -0
  57. package/docs/developer/CONTRIBUTING.md +227 -0
  58. package/docs/developer/DOCUMENTATION_SUMMARY.md +346 -0
  59. package/docs/developer/PROJECT_INDEX.md +365 -0
  60. package/docs/planning/API_COVERAGE.md +1045 -0
  61. package/docs/planning/BACKLOG.md +1159 -0
  62. package/docs/planning/PROFILE_SYSTEM_TASKS.md +287 -0
  63. package/docs/planning/UX_IMPLEMENTATION_PLAN.md +691 -0
  64. package/docs/planning/archive/RELEASE_CHECKLIST_v1.3.0.md +332 -0
  65. package/docs/planning/archive/RELEASE_v1.3.0.md +428 -0
  66. package/docs/planning/archive/cakemail-cli-ux-improvements.md +438 -0
  67. package/docs/planning/cakemail-profile-system-plan.md +1121 -0
  68. package/docs/testing/AI_USER_SIMULATION_DESIGN.md +1342 -0
  69. package/docs/testing/KENOGAMI_BIDIRECTIONAL_FLOW.md +1517 -0
  70. package/docs/testing/KENOGAMI_TRUTH_RECONCILIATION_SYSTEM.md +1369 -0
  71. package/docs/user-manual/.obsidian/app.json +1 -0
  72. package/docs/user-manual/.obsidian/appearance.json +1 -0
  73. package/docs/user-manual/.obsidian/core-plugins.json +33 -0
  74. package/docs/user-manual/.obsidian/workspace.json +167 -0
  75. package/docs/user-manual/01-getting-started/01-installation.md +214 -0
  76. package/docs/user-manual/01-getting-started/02-quick-start.md +432 -0
  77. package/docs/user-manual/01-getting-started/03-authentication.md +448 -0
  78. package/docs/user-manual/01-getting-started/04-configuration.md +430 -0
  79. package/docs/user-manual/01-getting-started/05-output-formats.md +447 -0
  80. package/docs/user-manual/02-core-concepts/01-accounts.md +514 -0
  81. package/docs/user-manual/02-core-concepts/02-profile-system.md +771 -0
  82. package/docs/user-manual/02-core-concepts/03-smart-defaults.md +485 -0
  83. package/docs/user-manual/02-core-concepts/04-authentication-methods.md +435 -0
  84. package/docs/user-manual/02-core-concepts/05-pagination-filtering.md +600 -0
  85. package/docs/user-manual/02-core-concepts/06-error-handling.md +718 -0
  86. package/docs/user-manual/02-core-concepts/07-api-coverage.md +483 -0
  87. package/docs/user-manual/03-email-operations/01-senders.md +490 -0
  88. package/docs/user-manual/03-email-operations/02-templates.md +444 -0
  89. package/docs/user-manual/03-email-operations/03-transactional-emails.md +706 -0
  90. package/docs/user-manual/03-email-operations/04-email-tracking.md +407 -0
  91. package/docs/user-manual/04-campaign-management/01-campaigns-basics.md +394 -0
  92. package/docs/user-manual/04-campaign-management/02-campaign-scheduling.md +630 -0
  93. package/docs/user-manual/04-campaign-management/03-campaign-testing.md +997 -0
  94. package/docs/user-manual/04-campaign-management/04-campaign-lifecycle.md +709 -0
  95. package/docs/user-manual/04-campaign-management/05-campaign-links.md +934 -0
  96. package/docs/user-manual/05-contact-management/01-lists.md +836 -0
  97. package/docs/user-manual/05-contact-management/02-contacts.md +1035 -0
  98. package/docs/user-manual/05-contact-management/03-custom-attributes.md +788 -0
  99. package/docs/user-manual/05-contact-management/04-segments.md +1028 -0
  100. package/docs/user-manual/05-contact-management/05-contact-import-export.md +1031 -0
  101. package/docs/user-manual/06-analytics-reporting/01-campaign-analytics.md +867 -0
  102. package/docs/user-manual/06-analytics-reporting/02-account-reports.md +227 -0
  103. package/docs/user-manual/07-integrations/01-webhooks-integration.md +259 -0
  104. package/docs/user-manual/07-integrations/02-automation.md +326 -0
  105. package/docs/user-manual/08-advanced-usage/01-scripting-patterns.md +672 -0
  106. package/docs/user-manual/08-advanced-usage/02-bulk-operations.md +932 -0
  107. package/docs/user-manual/08-advanced-usage/03-ci-cd-integration.md +892 -0
  108. package/docs/user-manual/08-advanced-usage/04-performance-optimization.md +766 -0
  109. package/docs/user-manual/09-command-reference/01-config.md +776 -0
  110. package/docs/user-manual/09-command-reference/02-account.md +652 -0
  111. package/docs/user-manual/09-command-reference/03-lists.md +958 -0
  112. package/docs/user-manual/09-command-reference/04-contacts.md +1408 -0
  113. package/docs/user-manual/09-command-reference/05-attributes.md +617 -0
  114. package/docs/user-manual/09-command-reference/06-segments.md +894 -0
  115. package/docs/user-manual/09-command-reference/07-senders.md +803 -0
  116. package/docs/user-manual/09-command-reference/08-templates.md +818 -0
  117. package/docs/user-manual/09-command-reference/09-campaigns.md +1250 -0
  118. package/docs/user-manual/09-command-reference/10-emails.md +807 -0
  119. package/docs/user-manual/09-command-reference/11-reports.md +1135 -0
  120. package/docs/user-manual/09-command-reference/12-webhooks.md +773 -0
  121. package/docs/user-manual/09-command-reference/13-suppressed.md +797 -0
  122. package/docs/user-manual/09-command-reference/14-interests.md +630 -0
  123. package/docs/user-manual/09-command-reference/15-tags.md +584 -0
  124. package/docs/user-manual/09-command-reference/16-logs.md +656 -0
  125. package/docs/user-manual/09-command-reference/17-transactional-templates.md +850 -0
  126. package/docs/user-manual/10-troubleshooting/01-common-errors.md +457 -0
  127. package/docs/user-manual/10-troubleshooting/02-authentication-issues.md +558 -0
  128. package/docs/user-manual/10-troubleshooting/03-connection-problems.md +634 -0
  129. package/docs/user-manual/10-troubleshooting/04-debugging.md +725 -0
  130. package/docs/user-manual/11-appendix/04-faq.md +484 -0
  131. package/docs/user-manual/11-appendix/05-glossary.md +250 -0
  132. package/docs/user-manual/README.md +0 -0
  133. package/package.json +13 -61
  134. package/src/cli.ts +125 -0
  135. package/src/client.ts +16 -0
  136. package/src/commands/account.ts +267 -0
  137. package/src/commands/accounts.ts +78 -0
  138. package/src/commands/actions.ts +249 -0
  139. package/src/commands/attributes.ts +139 -0
  140. package/src/commands/campaign-blueprints.ts +106 -0
  141. package/src/commands/campaigns.ts +469 -0
  142. package/src/commands/config.ts +77 -0
  143. package/src/commands/contacts.ts +612 -0
  144. package/src/commands/custom-attributes.ts +127 -0
  145. package/src/commands/dkims.ts +117 -0
  146. package/src/commands/domains.ts +82 -0
  147. package/src/commands/email-apis.ts +569 -0
  148. package/src/commands/emails.ts +197 -0
  149. package/src/commands/forms.ts +283 -0
  150. package/src/commands/interests.ts +155 -0
  151. package/src/commands/links.ts +38 -0
  152. package/src/commands/lists.ts +406 -0
  153. package/src/commands/logos.ts +71 -0
  154. package/src/commands/logs.ts +386 -0
  155. package/src/commands/reports.ts +306 -0
  156. package/src/commands/segments.ts +158 -0
  157. package/src/commands/senders.ts +204 -0
  158. package/src/commands/sub-accounts.ts +271 -0
  159. package/src/commands/suppressed-emails.ts +234 -0
  160. package/src/commands/suppressed.ts +198 -0
  161. package/src/commands/system-emails.ts +85 -0
  162. package/src/commands/tags.ts +146 -0
  163. package/src/commands/tasks.ts +116 -0
  164. package/src/commands/templates.ts +189 -0
  165. package/src/commands/tokens.ts +83 -0
  166. package/src/commands/transactional-emails.ts +374 -0
  167. package/src/commands/transactional-templates.ts +385 -0
  168. package/src/commands/users.ts +506 -0
  169. package/src/commands/webhooks.ts +172 -0
  170. package/src/commands/workflow-blueprints.ts +123 -0
  171. package/src/commands/workflows.ts +265 -0
  172. package/src/types/profile.ts +93 -0
  173. package/src/utils/auth.ts +272 -0
  174. package/src/utils/config-file.ts +96 -0
  175. package/src/utils/config.ts +134 -0
  176. package/src/utils/confirm.ts +32 -0
  177. package/src/utils/defaults.ts +99 -0
  178. package/src/utils/errors.ts +116 -0
  179. package/src/utils/interactive.ts +91 -0
  180. package/src/utils/list-defaults.ts +74 -0
  181. package/src/utils/output.ts +190 -0
  182. package/src/utils/progress.ts +320 -0
  183. package/src/utils/spinner.ts +22 -0
  184. package/tests/IMPLEMENTATION_STATUS.md +258 -0
  185. package/tests/PTY_SETUP.md +118 -0
  186. package/tests/PTY_TESTING_GUIDE.md +507 -0
  187. package/tests/README.md +244 -0
  188. package/tests/fixtures/api-responses/campaigns.json +34 -0
  189. package/tests/fixtures/test-config.json +13 -0
  190. package/tests/helpers/cli-runner.ts +128 -0
  191. package/tests/helpers/mock-server.ts +301 -0
  192. package/tests/helpers/pty-runner.ts +181 -0
  193. package/tests/integration/campaigns-real-api.test.ts +196 -0
  194. package/tests/integration/setup-integration.ts +50 -0
  195. package/tests/pty/campaigns.test.ts +241 -0
  196. package/tests/setup.ts +34 -0
  197. package/tsconfig.json +15 -0
  198. package/vitest.config.ts +28 -0
@@ -0,0 +1,1135 @@
1
+ # Report Commands
2
+
3
+ Access analytics, statistics, and export reports for campaigns, lists, and email activity.
4
+
5
+ ## Overview
6
+
7
+ Report commands allow you to:
8
+ - View campaign performance analytics (opens, clicks, bounces)
9
+ - Analyze link click statistics for campaigns
10
+ - Get list growth and engagement metrics
11
+ - Access account-wide statistics
12
+ - View Email API delivery and engagement stats
13
+ - Export campaign and transactional email data
14
+ - Monitor transactional email performance
15
+
16
+ Reports provide insights into email performance, audience engagement, and delivery metrics to help optimize your email marketing and transactional email strategies.
17
+
18
+ ## Commands
19
+
20
+ - [reports campaign](#reports-campaign) - Get campaign analytics
21
+ - [reports campaign-links](#reports-campaign-links) - Get campaign link analytics
22
+ - [reports list](#reports-list) - Get list statistics
23
+ - [reports account](#reports-account) - Get account-wide analytics
24
+ - [reports emails](#reports-emails) - Get Email API statistics
25
+ - [reports emails-summary](#reports-emails-summary) - Get Email API summary
26
+ - [reports transactional-emails](#reports-transactional-emails) - Get transactional email stats
27
+ - [reports campaigns-exports](#reports-campaigns-exports) - List campaign report exports
28
+ - [reports export-campaigns](#reports-export-campaigns) - Create campaign export
29
+ - [reports campaigns-export](#reports-campaigns-export) - Get export status
30
+ - [reports download-campaigns-export](#reports-download-campaigns-export) - Download export
31
+ - [reports delete-campaigns-export](#reports-delete-campaigns-export) - Delete export
32
+
33
+ ---
34
+
35
+ ## reports campaign
36
+
37
+ Get comprehensive analytics and statistics for a specific campaign.
38
+
39
+ ### Usage
40
+
41
+ ```bash
42
+ cakemail reports campaign <id>
43
+ ```
44
+
45
+ ### Arguments
46
+
47
+ - `id` - Campaign ID (required)
48
+
49
+ ### Examples
50
+
51
+ **Get campaign report:**
52
+
53
+ ```bash
54
+ $ cakemail reports campaign 790
55
+ ```
56
+
57
+ **Output:**
58
+ ```
59
+ {
60
+ "campaign_id": 790,
61
+ "campaign_name": "Weekly Newsletter - March 15",
62
+ "sent_date": "2024-03-15T10:00:00Z",
63
+ "recipients": 1234,
64
+ "delivered": 1200,
65
+ "bounced": 34,
66
+ "opens": 456,
67
+ "unique_opens": 389,
68
+ "clicks": 123,
69
+ "unique_clicks": 98,
70
+ "unsubscribes": 5,
71
+ "complaints": 1,
72
+ "open_rate": 0.324,
73
+ "click_rate": 0.082,
74
+ "click_to_open_rate": 0.252,
75
+ "bounce_rate": 0.028
76
+ }
77
+ ```
78
+
79
+ **Extract key metrics:**
80
+
81
+ ```bash
82
+ $ cakemail reports campaign 790 -f json | jq '{open_rate, click_rate, bounce_rate}'
83
+ ```
84
+
85
+ **Output:**
86
+ ```json
87
+ {
88
+ "open_rate": 0.324,
89
+ "click_rate": 0.082,
90
+ "bounce_rate": 0.028
91
+ }
92
+ ```
93
+
94
+ **Compare multiple campaigns:**
95
+
96
+ ```bash
97
+ for id in 790 791 792; do
98
+ echo "Campaign $id:"
99
+ cakemail reports campaign $id -f json | jq '{opens: .unique_opens, clicks: .unique_clicks, rate: .open_rate}'
100
+ done
101
+ ```
102
+
103
+ **Output:**
104
+ ```
105
+ Campaign 790:
106
+ {"opens": 389, "clicks": 98, "rate": 0.324}
107
+ Campaign 791:
108
+ {"opens": 412, "clicks": 105, "rate": 0.338}
109
+ Campaign 792:
110
+ {"opens": 395, "clicks": 91, "rate": 0.315}
111
+ ```
112
+
113
+ ### Metrics Explained
114
+
115
+ - **Recipients**: Total contacts campaign was sent to
116
+ - **Delivered**: Successfully delivered emails
117
+ - **Bounced**: Failed deliveries (hard + soft bounces)
118
+ - **Opens**: Total open events (includes multiple opens per contact)
119
+ - **Unique Opens**: Number of contacts who opened at least once
120
+ - **Clicks**: Total click events
121
+ - **Unique Clicks**: Number of contacts who clicked at least once
122
+ - **Open Rate**: Unique opens / delivered
123
+ - **Click Rate**: Unique clicks / delivered
124
+ - **Click-to-Open Rate**: Unique clicks / unique opens
125
+ - **Bounce Rate**: Bounced / recipients
126
+
127
+ ### Notes
128
+
129
+ - Data updates in real-time as recipients engage
130
+ - Opens tracked via pixel (requires HTML content and images enabled)
131
+ - Clicks tracked via link rewrites
132
+ - Historical data available for all sent campaigns
133
+ - Rates are decimal values (0.324 = 32.4%)
134
+
135
+ ### Related Commands
136
+
137
+ - [reports campaign-links](#reports-campaign-links) - Detailed link analytics
138
+ - [campaigns get](/en/cli/command-reference/campaigns#campaigns-get) - Campaign details
139
+ - [campaigns list](/en/cli/command-reference/campaigns#campaigns-list) - Find campaign IDs
140
+
141
+ ---
142
+
143
+ ## reports campaign-links
144
+
145
+ Get detailed link click analytics for a specific campaign.
146
+
147
+ ### Usage
148
+
149
+ ```bash
150
+ cakemail reports campaign-links <id>
151
+ ```
152
+
153
+ ### Arguments
154
+
155
+ - `id` - Campaign ID (required)
156
+
157
+ ### Examples
158
+
159
+ **Get link analytics:**
160
+
161
+ ```bash
162
+ $ cakemail reports campaign-links 790
163
+ ```
164
+
165
+ **Output:**
166
+ ```
167
+ {
168
+ "campaign_id": 790,
169
+ "links": [
170
+ {
171
+ "url": "https://example.com/products",
172
+ "clicks": 78,
173
+ "unique_clicks": 65,
174
+ "percentage": 0.663
175
+ },
176
+ {
177
+ "url": "https://example.com/blog",
178
+ "clicks": 45,
179
+ "unique_clicks": 33,
180
+ "percentage": 0.337
181
+ }
182
+ ],
183
+ "total_clicks": 123,
184
+ "total_unique_clicks": 98
185
+ }
186
+ ```
187
+
188
+ **Find most clicked link:**
189
+
190
+ ```bash
191
+ $ cakemail reports campaign-links 790 -f json | jq '.links | sort_by(.unique_clicks) | reverse | .[0]'
192
+ ```
193
+
194
+ **Output:**
195
+ ```json
196
+ {
197
+ "url": "https://example.com/products",
198
+ "clicks": 78,
199
+ "unique_clicks": 65,
200
+ "percentage": 0.663
201
+ }
202
+ ```
203
+
204
+ **Export link data:**
205
+
206
+ ```bash
207
+ $ cakemail reports campaign-links 790 -f json | jq -r '.links[] | "\(.url),\(.unique_clicks)"' > link-performance.csv
208
+ ```
209
+
210
+ **Output (link-performance.csv):**
211
+ ```
212
+ https://example.com/products,65
213
+ https://example.com/blog,33
214
+ ```
215
+
216
+ ### Notes
217
+
218
+ - Only includes trackable links (HTTP/HTTPS)
219
+ - Unsubscribe links not included in click counts
220
+ - Percentage shows portion of total unique clicks
221
+ - Links sorted by unique clicks (descending)
222
+ - Multiple clicks per contact counted in "clicks" field
223
+
224
+ ### Related Commands
225
+
226
+ - [reports campaign](#reports-campaign) - Overall campaign analytics
227
+ - [campaigns links](/en/cli/command-reference/campaigns#campaigns-links) - View campaign links
228
+
229
+ ---
230
+
231
+ ## reports list
232
+
233
+ Get analytics and statistics for a specific contact list.
234
+
235
+ ### Usage
236
+
237
+ ```bash
238
+ cakemail reports list <id>
239
+ ```
240
+
241
+ ### Arguments
242
+
243
+ - `id` - List ID (required)
244
+
245
+ ### Examples
246
+
247
+ **Get list report:**
248
+
249
+ ```bash
250
+ $ cakemail reports list 123
251
+ ```
252
+
253
+ **Output:**
254
+ ```
255
+ {
256
+ "list_id": 123,
257
+ "list_name": "Newsletter Subscribers",
258
+ "total_contacts": 1234,
259
+ "subscribed": 1180,
260
+ "unsubscribed": 54,
261
+ "bounced": 0,
262
+ "complained": 0,
263
+ "growth_rate": 0.156,
264
+ "churn_rate": 0.044,
265
+ "engagement_rate": 0.312,
266
+ "campaigns_sent": 12,
267
+ "last_campaign_date": "2024-03-15T10:00:00Z"
268
+ }
269
+ ```
270
+
271
+ **Track list growth over time:**
272
+
273
+ ```bash
274
+ $ cakemail reports list 123 -f json | jq '{total: .total_contacts, active: .subscribed, growth: .growth_rate}'
275
+ ```
276
+
277
+ **Output:**
278
+ ```json
279
+ {
280
+ "total": 1234,
281
+ "active": 1180,
282
+ "growth": 0.156
283
+ }
284
+ ```
285
+
286
+ **Compare multiple lists:**
287
+
288
+ ```bash
289
+ for id in 123 124 125; do
290
+ echo "List $id:"
291
+ cakemail reports list $id -f json | jq '{contacts: .subscribed, engagement: .engagement_rate}'
292
+ done
293
+ ```
294
+
295
+ ### Metrics Explained
296
+
297
+ - **Total Contacts**: All contacts in list (all statuses)
298
+ - **Subscribed**: Active subscribed contacts
299
+ - **Unsubscribed**: Contacts who unsubscribed
300
+ - **Bounced**: Contacts with bounced status
301
+ - **Complained**: Contacts who marked email as spam
302
+ - **Growth Rate**: New subscribers / total contacts (30-day period)
303
+ - **Churn Rate**: Unsubscribes / total contacts (30-day period)
304
+ - **Engagement Rate**: (Opens + clicks) / delivered (30-day avg)
305
+
306
+ ### Notes
307
+
308
+ - Growth and churn calculated over trailing 30 days
309
+ - Engagement based on recent campaign performance
310
+ - Historical data shows list health trends
311
+ - Use to identify declining list quality
312
+
313
+ ### Related Commands
314
+
315
+ - [lists get](/en/cli/command-reference/lists#lists-get) - List details
316
+ - [contacts list](/en/cli/command-reference/contacts#contacts-list) - View list contacts
317
+ - [reports account](#reports-account) - Account-wide stats
318
+
319
+ ---
320
+
321
+ ## reports account
322
+
323
+ Get account-wide analytics and statistics across all lists and campaigns.
324
+
325
+ ### Usage
326
+
327
+ ```bash
328
+ cakemail reports account
329
+ ```
330
+
331
+ ### Examples
332
+
333
+ **Get account report:**
334
+
335
+ ```bash
336
+ $ cakemail reports account
337
+ ```
338
+
339
+ **Output:**
340
+ ```
341
+ {
342
+ "account_id": 456,
343
+ "total_lists": 5,
344
+ "total_contacts": 6789,
345
+ "active_contacts": 6234,
346
+ "total_campaigns": 48,
347
+ "campaigns_this_month": 12,
348
+ "emails_sent_this_month": 67890,
349
+ "average_open_rate": 0.298,
350
+ "average_click_rate": 0.074,
351
+ "average_bounce_rate": 0.023,
352
+ "email_api_sent_this_month": 1234,
353
+ "account_usage": {
354
+ "contacts_limit": 10000,
355
+ "contacts_used": 6789,
356
+ "emails_limit": 100000,
357
+ "emails_used": 69124
358
+ }
359
+ }
360
+ ```
361
+
362
+ **Check account usage:**
363
+
364
+ ```bash
365
+ $ cakemail reports account -f json | jq '.account_usage'
366
+ ```
367
+
368
+ **Output:**
369
+ ```json
370
+ {
371
+ "contacts_limit": 10000,
372
+ "contacts_used": 6789,
373
+ "emails_limit": 100000,
374
+ "emails_used": 69124
375
+ }
376
+ ```
377
+
378
+ **Monitor monthly activity:**
379
+
380
+ ```bash
381
+ $ cakemail reports account -f json | jq '{campaigns: .campaigns_this_month, emails: .emails_sent_this_month}'
382
+ ```
383
+
384
+ **Output:**
385
+ ```json
386
+ {
387
+ "campaigns": 12,
388
+ "emails": 67890
389
+ }
390
+ ```
391
+
392
+ ### Notes
393
+
394
+ - Includes all lists and campaigns in account
395
+ - Monthly metrics reset on the 1st of each month
396
+ - Average rates calculated across all campaigns
397
+ - Usage limits based on account tier
398
+ - Use to monitor account health and limits
399
+
400
+ ### Related Commands
401
+
402
+ - [reports list](#reports-list) - Individual list analytics
403
+ - [reports campaign](#reports-campaign) - Individual campaign analytics
404
+ - [account show](/en/cli/command-reference/account#account-show) - Account details
405
+
406
+ ---
407
+
408
+ ## reports emails
409
+
410
+ Get Email API statistics for transactional emails.
411
+
412
+ ### Usage
413
+
414
+ ```bash
415
+ cakemail reports emails [options]
416
+ ```
417
+
418
+ ### Options
419
+
420
+ - `--from <date>` - Start date (YYYY-MM-DD format)
421
+ - `--to <date>` - End date (YYYY-MM-DD format)
422
+
423
+ ### Examples
424
+
425
+ **Get recent email stats:**
426
+
427
+ ```bash
428
+ $ cakemail reports emails
429
+ ```
430
+
431
+ **Output:**
432
+ ```
433
+ {
434
+ "total_sent": 1234,
435
+ "delivered": 1198,
436
+ "bounced": 36,
437
+ "opens": 456,
438
+ "unique_opens": 389,
439
+ "clicks": 123,
440
+ "unique_clicks": 98,
441
+ "complaints": 2,
442
+ "delivery_rate": 0.971,
443
+ "open_rate": 0.325,
444
+ "click_rate": 0.082
445
+ }
446
+ ```
447
+
448
+ **Get stats for specific date range:**
449
+
450
+ ```bash
451
+ $ cakemail reports emails --from 2024-03-01 --to 2024-03-15
452
+ ```
453
+
454
+ **Output:**
455
+ ```
456
+ {
457
+ "period": {
458
+ "from": "2024-03-01",
459
+ "to": "2024-03-15"
460
+ },
461
+ "total_sent": 567,
462
+ "delivered": 551,
463
+ "bounced": 16,
464
+ "opens": 189,
465
+ "clicks": 45
466
+ }
467
+ ```
468
+
469
+ **Track daily performance:**
470
+
471
+ ```bash
472
+ $ cakemail reports emails --from 2024-03-15 --to 2024-03-15 -f json | jq '{sent: .total_sent, delivered: .delivered, rate: .delivery_rate}'
473
+ ```
474
+
475
+ ### Notes
476
+
477
+ - Defaults to last 30 days if no date range specified
478
+ - Includes all Email API v2 transactional emails
479
+ - Does not include campaign emails
480
+ - Real-time statistics (updates continuously)
481
+ - Useful for monitoring transactional email health
482
+
483
+ ### Related Commands
484
+
485
+ - [reports emails-summary](#reports-emails-summary) - Detailed daily breakdown
486
+ - [reports transactional-emails](#reports-transactional-emails) - Template-based email stats
487
+ - [emails logs](/en/cli/command-reference/emails#emails-logs) - Individual email logs
488
+
489
+ ---
490
+
491
+ ## reports emails-summary
492
+
493
+ Get detailed Email API activity summary with daily breakdown.
494
+
495
+ ### Usage
496
+
497
+ ```bash
498
+ cakemail reports emails-summary [options]
499
+ ```
500
+
501
+ ### Options
502
+
503
+ - `--from <date>` - Start date (YYYY-MM-DD format)
504
+ - `--to <date>` - End date (YYYY-MM-DD format)
505
+
506
+ ### Examples
507
+
508
+ **Get activity summary:**
509
+
510
+ ```bash
511
+ $ cakemail reports emails-summary --from 2024-03-01 --to 2024-03-07
512
+ ```
513
+
514
+ **Output:**
515
+ ```
516
+ {
517
+ "period": {
518
+ "from": "2024-03-01",
519
+ "to": "2024-03-07"
520
+ },
521
+ "daily_stats": [
522
+ {
523
+ "date": "2024-03-01",
524
+ "sent": 89,
525
+ "delivered": 87,
526
+ "bounced": 2,
527
+ "opens": 34,
528
+ "clicks": 12
529
+ },
530
+ {
531
+ "date": "2024-03-02",
532
+ "sent": 112,
533
+ "delivered": 109,
534
+ "bounced": 3,
535
+ "opens": 45,
536
+ "clicks": 15
537
+ }
538
+ ],
539
+ "totals": {
540
+ "sent": 678,
541
+ "delivered": 660,
542
+ "bounced": 18
543
+ }
544
+ }
545
+ ```
546
+
547
+ **Find peak send day:**
548
+
549
+ ```bash
550
+ $ cakemail reports emails-summary --from 2024-03-01 --to 2024-03-31 -f json | jq '.daily_stats | sort_by(.sent) | reverse | .[0]'
551
+ ```
552
+
553
+ **Output:**
554
+ ```json
555
+ {
556
+ "date": "2024-03-15",
557
+ "sent": 156,
558
+ "delivered": 152,
559
+ "bounced": 4,
560
+ "opens": 67,
561
+ "clicks": 23
562
+ }
563
+ ```
564
+
565
+ ### Notes
566
+
567
+ - Provides day-by-day breakdown
568
+ - Useful for identifying trends and patterns
569
+ - Date range required (max 90 days)
570
+ - Includes totals across full period
571
+
572
+ ### Related Commands
573
+
574
+ - [reports emails](#reports-emails) - Aggregate email stats
575
+ - [emails logs](/en/cli/command-reference/emails#emails-logs) - Detailed email logs
576
+
577
+ ---
578
+
579
+ ## reports transactional-emails
580
+
581
+ Get statistics for transactional emails sent via templates.
582
+
583
+ ### Usage
584
+
585
+ ```bash
586
+ cakemail reports transactional-emails [options]
587
+ ```
588
+
589
+ ### Options
590
+
591
+ - `--from <date>` - Start date (YYYY-MM-DD format)
592
+ - `--to <date>` - End date (YYYY-MM-DD format)
593
+
594
+ ### Examples
595
+
596
+ **Get transactional email stats:**
597
+
598
+ ```bash
599
+ $ cakemail reports transactional-emails
600
+ ```
601
+
602
+ **Output:**
603
+ ```
604
+ {
605
+ "total_sent": 456,
606
+ "delivered": 445,
607
+ "bounced": 11,
608
+ "opens": 234,
609
+ "unique_opens": 198,
610
+ "clicks": 67,
611
+ "unique_clicks": 54,
612
+ "templates": [
613
+ {
614
+ "template_id": 789,
615
+ "template_name": "Password Reset",
616
+ "sent": 234,
617
+ "opens": 198,
618
+ "clicks": 45
619
+ },
620
+ {
621
+ "template_id": 790,
622
+ "template_name": "Welcome Email",
623
+ "sent": 156,
624
+ "opens": 123,
625
+ "clicks": 18
626
+ }
627
+ ]
628
+ }
629
+ ```
630
+
631
+ **Get stats for date range:**
632
+
633
+ ```bash
634
+ $ cakemail reports transactional-emails --from 2024-03-01 --to 2024-03-15
635
+ ```
636
+
637
+ **Find best performing template:**
638
+
639
+ ```bash
640
+ $ cakemail reports transactional-emails -f json | jq '.templates | sort_by(.clicks) | reverse | .[0]'
641
+ ```
642
+
643
+ **Output:**
644
+ ```json
645
+ {
646
+ "template_id": 789,
647
+ "template_name": "Password Reset",
648
+ "sent": 234,
649
+ "opens": 198,
650
+ "clicks": 45
651
+ }
652
+ ```
653
+
654
+ ### Notes
655
+
656
+ - Only includes emails sent via templates
657
+ - Template breakdown helps identify performance
658
+ - Defaults to last 30 days if no dates specified
659
+ - Does not include non-template Email API emails
660
+
661
+ ### Related Commands
662
+
663
+ - [transactional-templates list](/en/cli/command-reference/transactional-templates#transactional-templates-list) - View templates
664
+ - [reports emails](#reports-emails) - All Email API stats
665
+
666
+ ---
667
+
668
+ ## reports campaigns-exports
669
+
670
+ List all campaign report exports.
671
+
672
+ ### Usage
673
+
674
+ ```bash
675
+ cakemail reports campaigns-exports [options]
676
+ ```
677
+
678
+ ### Options
679
+
680
+ - `-l, --limit <number>` - Limit number of results
681
+ - `-p, --page <number>` - Page number
682
+
683
+ ### Examples
684
+
685
+ **List all exports:**
686
+
687
+ ```bash
688
+ $ cakemail reports campaigns-exports
689
+ ```
690
+
691
+ **Output:**
692
+ ```
693
+ ┌──────────────┬──────────┬─────────────────────┬────────────┐
694
+ │ ID │ Status │ Created │ Records │
695
+ ├──────────────┼──────────┼─────────────────────┼────────────┤
696
+ │ export_abc123│ ready │ 2024-03-15 10:30:00 │ 12 │
697
+ │ export_def456│ processing│ 2024-03-15 10:35:00│ - │
698
+ │ export_ghi789│ ready │ 2024-03-14 14:20:00 │ 8 │
699
+ └──────────────┴──────────┴─────────────────────┴────────────┘
700
+ ```
701
+
702
+ **List recent exports:**
703
+
704
+ ```bash
705
+ $ cakemail reports campaigns-exports -l 5
706
+ ```
707
+
708
+ ### Notes
709
+
710
+ - Shows all export jobs regardless of status
711
+ - Exports expire after 30 days
712
+ - Use to find previous exports before creating new ones
713
+
714
+ ### Related Commands
715
+
716
+ - [reports export-campaigns](#reports-export-campaigns) - Create new export
717
+ - [reports campaigns-export](#reports-campaigns-export) - Get export details
718
+
719
+ ---
720
+
721
+ ## reports export-campaigns
722
+
723
+ Create and download a campaign report export.
724
+
725
+ ### Usage
726
+
727
+ ```bash
728
+ cakemail reports export-campaigns [options]
729
+ ```
730
+
731
+ ### Options
732
+
733
+ - `--from <date>` - Start date (YYYY-MM-DD format)
734
+ - `--to <date>` - End date (YYYY-MM-DD format)
735
+ - `--status <status>` - Filter by campaign status
736
+ - `--no-wait` - Create export without waiting for completion
737
+
738
+ ### Examples
739
+
740
+ **Export all campaigns:**
741
+
742
+ ```bash
743
+ $ cakemail reports export-campaigns
744
+ ```
745
+
746
+ **Output:**
747
+ ```
748
+ ✓ Export job created
749
+ ⠋ Waiting for export to complete...
750
+ ✓ Export ready
751
+ ℹ Export completed. Download with: cakemail reports download-campaigns-export export_abc123
752
+ {
753
+ "id": "export_abc123",
754
+ "status": "ready",
755
+ "created_at": "2024-03-15T10:30:00Z"
756
+ }
757
+ ```
758
+
759
+ **Export campaigns for date range:**
760
+
761
+ ```bash
762
+ $ cakemail reports export-campaigns --from 2024-03-01 --to 2024-03-15
763
+ ```
764
+
765
+ **Export without waiting:**
766
+
767
+ ```bash
768
+ $ cakemail reports export-campaigns --no-wait
769
+ ```
770
+
771
+ **Output:**
772
+ ```
773
+ ✓ Export job created
774
+ ℹ Export ID: export_def456
775
+ ℹ Check status with: cakemail reports campaigns-export export_def456
776
+ ```
777
+
778
+ **Export by status:**
779
+
780
+ ```bash
781
+ $ cakemail reports export-campaigns --status sent
782
+ ```
783
+
784
+ ### Notes
785
+
786
+ - Default behavior waits for export completion (polls every 2 seconds)
787
+ - Use `--no-wait` for large exports to avoid timeout
788
+ - Export includes all campaign metrics
789
+ - CSV format suitable for analysis in Excel/Google Sheets
790
+ - Download URL expires after 24 hours
791
+
792
+ ### Related Commands
793
+
794
+ - [reports download-campaigns-export](#reports-download-campaigns-export) - Download export
795
+ - [reports campaigns-export](#reports-campaigns-export) - Check export status
796
+ - [reports campaigns-exports](#reports-campaigns-exports) - List all exports
797
+
798
+ ---
799
+
800
+ ## reports campaigns-export
801
+
802
+ Get the status and details of a campaign report export.
803
+
804
+ ### Usage
805
+
806
+ ```bash
807
+ cakemail reports campaigns-export <id>
808
+ ```
809
+
810
+ ### Arguments
811
+
812
+ - `id` - Export ID (required)
813
+
814
+ ### Examples
815
+
816
+ **Check export status:**
817
+
818
+ ```bash
819
+ $ cakemail reports campaigns-export export_abc123
820
+ ```
821
+
822
+ **Output:**
823
+ ```
824
+ {
825
+ "id": "export_abc123",
826
+ "status": "ready",
827
+ "created_at": "2024-03-15T10:30:00Z",
828
+ "completed_at": "2024-03-15T10:31:30Z",
829
+ "download_url": "https://api.cakemail.com/exports/...",
830
+ "expires_at": "2024-04-14T10:31:30Z",
831
+ "records": 12
832
+ }
833
+ ```
834
+
835
+ **Monitor processing export:**
836
+
837
+ ```bash
838
+ $ cakemail reports campaigns-export export_def456
839
+ ```
840
+
841
+ **Output:**
842
+ ```
843
+ {
844
+ "id": "export_def456",
845
+ "status": "processing",
846
+ "created_at": "2024-03-15T10:35:00Z",
847
+ "progress": 65
848
+ }
849
+ ```
850
+
851
+ ### Status Values
852
+
853
+ - `processing` - Export is being generated
854
+ - `ready` - Export is ready for download
855
+ - `error` - Export failed
856
+
857
+ ### Notes
858
+
859
+ - Use to poll export status when using `--no-wait`
860
+ - Download URL only available when status is `ready`
861
+ - Progress percentage shown for processing exports
862
+
863
+ ### Related Commands
864
+
865
+ - [reports export-campaigns](#reports-export-campaigns) - Create export
866
+ - [reports download-campaigns-export](#reports-download-campaigns-export) - Download ready export
867
+
868
+ ---
869
+
870
+ ## reports download-campaigns-export
871
+
872
+ Download a completed campaign report export file.
873
+
874
+ ### Usage
875
+
876
+ ```bash
877
+ cakemail reports download-campaigns-export <id>
878
+ ```
879
+
880
+ ### Arguments
881
+
882
+ - `id` - Export ID (required)
883
+
884
+ ### Examples
885
+
886
+ **Download export:**
887
+
888
+ ```bash
889
+ $ cakemail reports download-campaigns-export export_abc123
890
+ ```
891
+
892
+ **Output:**
893
+ ```
894
+ ✓ Export downloaded
895
+ {
896
+ "filename": "campaigns_export_abc123.csv",
897
+ "size": 12456,
898
+ "download_url": "https://..."
899
+ }
900
+ ```
901
+
902
+ **Save to specific file:**
903
+
904
+ ```bash
905
+ $ cakemail reports download-campaigns-export export_abc123 -f json | jq -r '.content' > campaigns.csv
906
+ ```
907
+
908
+ ### Notes
909
+
910
+ - Export must have status `ready` before download
911
+ - File format is CSV
912
+ - Download URL expires after 24 hours
913
+ - Large files may take time to download
914
+
915
+ ### Related Commands
916
+
917
+ - [reports export-campaigns](#reports-export-campaigns) - Create export
918
+ - [reports campaigns-export](#reports-campaigns-export) - Check if ready
919
+
920
+ ---
921
+
922
+ ## reports delete-campaigns-export
923
+
924
+ Delete a campaign report export file.
925
+
926
+ ### Usage
927
+
928
+ ```bash
929
+ cakemail reports delete-campaigns-export <id> [options]
930
+ ```
931
+
932
+ ### Arguments
933
+
934
+ - `id` - Export ID (required)
935
+
936
+ ### Options
937
+
938
+ - `-f, --force` - Skip confirmation prompt
939
+
940
+ ### Examples
941
+
942
+ **Delete export with confirmation:**
943
+
944
+ ```bash
945
+ $ cakemail reports delete-campaigns-export export_abc123
946
+ ```
947
+
948
+ **Output:**
949
+ ```
950
+ ⚠ Delete campaigns report export export_abc123?
951
+
952
+ The following will happen:
953
+ • Export file will be permanently deleted
954
+
955
+ Type 'yes' to confirm: yes
956
+
957
+ ✓ Export export_abc123 deleted
958
+ ```
959
+
960
+ **Force delete:**
961
+
962
+ ```bash
963
+ $ cakemail reports delete-campaigns-export export_abc123 --force
964
+ ```
965
+
966
+ **Output:**
967
+ ```
968
+ ✓ Export export_abc123 deleted
969
+ ```
970
+
971
+ ### Notes
972
+
973
+ - Deletion is permanent
974
+ - Export data cannot be recovered
975
+ - Exports auto-delete after 30 days
976
+
977
+ ### Related Commands
978
+
979
+ - [reports campaigns-exports](#reports-campaigns-exports) - List exports before deletion
980
+
981
+ ---
982
+
983
+ ## Common Workflows
984
+
985
+ ### Workflow 1: Campaign Performance Analysis
986
+
987
+ ```bash
988
+ # Get overall campaign stats
989
+ $ cakemail reports campaign 790
990
+
991
+ # Analyze link performance
992
+ $ cakemail reports campaign-links 790
993
+
994
+ # Compare with previous campaign
995
+ $ cakemail reports campaign 789 -f json | jq '{open_rate, click_rate}'
996
+ $ cakemail reports campaign 790 -f json | jq '{open_rate, click_rate}'
997
+ ```
998
+
999
+ ### Workflow 2: Monthly Report Generation
1000
+
1001
+ ```bash
1002
+ # Export all campaigns from last month
1003
+ $ cakemail reports export-campaigns --from 2024-02-01 --to 2024-02-29
1004
+
1005
+ # Wait for completion and download
1006
+ $ cakemail reports download-campaigns-export export_abc123
1007
+
1008
+ # Get account summary
1009
+ $ cakemail reports account > monthly-account-report.json
1010
+
1011
+ # Get Email API stats
1012
+ $ cakemail reports emails --from 2024-02-01 --to 2024-02-29 > monthly-email-stats.json
1013
+ ```
1014
+
1015
+ ### Workflow 3: List Health Check
1016
+
1017
+ ```bash
1018
+ # Check all lists
1019
+ for id in $(cakemail lists list -f json | jq -r '.data[].id'); do
1020
+ echo "List $id:"
1021
+ cakemail reports list $id -f json | jq '{subscribed, engagement_rate, churn_rate}'
1022
+ done
1023
+
1024
+ # Identify declining lists
1025
+ $ cakemail reports list 123 -f json | jq 'select(.churn_rate > 0.05)'
1026
+ ```
1027
+
1028
+ ### Workflow 4: Email API Monitoring
1029
+
1030
+ ```bash
1031
+ # Daily email stats check
1032
+ $ cakemail reports emails --from $(date +%Y-%m-%d) --to $(date +%Y-%m-%d)
1033
+
1034
+ # Check delivery rate
1035
+ $ cakemail reports emails -f json | jq '.delivery_rate'
1036
+
1037
+ # Alert if delivery rate drops
1038
+ RATE=$(cakemail reports emails -f json | jq -r '.delivery_rate')
1039
+ if (( $(echo "$RATE < 0.95" | bc -l) )); then
1040
+ echo "⚠ Warning: Delivery rate below 95%: $RATE"
1041
+ fi
1042
+ ```
1043
+
1044
+ ## Best Practices
1045
+
1046
+ 1. **Regular Monitoring**: Check campaign reports after each send
1047
+ 2. **Track Trends**: Export monthly data for trend analysis
1048
+ 3. **Link Analysis**: Use link reports to optimize CTAs
1049
+ 4. **List Health**: Monitor list engagement and churn rates
1050
+ 5. **Email API**: Track transactional email delivery rates daily
1051
+ 6. **Export Archives**: Keep monthly exports for historical records
1052
+ 7. **Benchmark**: Compare performance against industry standards
1053
+ 8. **Segment Analysis**: Analyze performance by list/segment
1054
+
1055
+ ## Troubleshooting
1056
+
1057
+ ### Error: "Campaign ID not found"
1058
+
1059
+ Campaign doesn't exist or was deleted.
1060
+
1061
+ **Solution:**
1062
+ ```bash
1063
+ # List campaigns to verify ID
1064
+ $ cakemail campaigns list
1065
+
1066
+ # Use correct campaign ID
1067
+ $ cakemail reports campaign 790
1068
+ ```
1069
+
1070
+ ### No Data in Reports
1071
+
1072
+ Campaign may not have been sent yet.
1073
+
1074
+ **Solution:**
1075
+ ```bash
1076
+ # Check campaign status
1077
+ $ cakemail campaigns get 790 -f json | jq '.status'
1078
+
1079
+ # Only sent campaigns have report data
1080
+ ```
1081
+
1082
+ ### Export Taking Too Long
1083
+
1084
+ Large data sets may timeout.
1085
+
1086
+ **Solution:**
1087
+ ```bash
1088
+ # Use --no-wait for large exports
1089
+ $ cakemail reports export-campaigns --from 2024-01-01 --to 2024-12-31 --no-wait
1090
+
1091
+ # Check status separately
1092
+ $ cakemail reports campaigns-export export_abc123
1093
+
1094
+ # Download when ready
1095
+ $ cakemail reports download-campaigns-export export_abc123
1096
+ ```
1097
+
1098
+ ### Low Open Rates
1099
+
1100
+ Multiple possible causes.
1101
+
1102
+ **Solution:**
1103
+ ```bash
1104
+ # Check subject line effectiveness
1105
+ # Review send times
1106
+ # Verify list quality with list report
1107
+ $ cakemail reports list 123
1108
+
1109
+ # Check for high bounce rates
1110
+ $ cakemail reports campaign 790 -f json | jq '.bounce_rate'
1111
+ ```
1112
+
1113
+ ### High Bounce Rate
1114
+
1115
+ List quality issue or delivery problems.
1116
+
1117
+ **Solution:**
1118
+ ```bash
1119
+ # Identify bounced emails
1120
+ $ cakemail emails logs --status bounced
1121
+
1122
+ # Clean list
1123
+ $ cakemail contacts list 123 --filter "status==bounced"
1124
+
1125
+ # Add to suppression list
1126
+ $ cakemail suppressed add -e "bounced@example.com" -r "hard-bounce"
1127
+ ```
1128
+
1129
+ ---
1130
+
1131
+ **Related Documentation:**
1132
+ - [Campaigns Commands](/en/cli/command-reference/campaigns/) - Manage campaigns
1133
+ - [Lists Commands](/en/cli/command-reference/lists/) - Manage lists
1134
+ - [Emails Commands](/en/cli/command-reference/emails/) - Transactional emails
1135
+ - [Transactional Templates Commands](/en/cli/command-reference/transactional-templates/) - Email templates