sendlit 0.3.0 → 0.4.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.
- package/README.md +14 -1
- package/dist/index.d.mts +9286 -4531
- package/dist/index.d.ts +9286 -4531
- package/dist/index.js +615 -125
- package/dist/index.mjs +615 -125
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -230,6 +230,151 @@ statuses({ skip: "pending_confirmation" }, [
|
|
|
230
230
|
"awaiting_confirmation",
|
|
231
231
|
"not_confirmed"
|
|
232
232
|
]);
|
|
233
|
+
var organizationRoleSchema = zod.z.enum(["owner", "admin", "member"]);
|
|
234
|
+
var organizationSchema = zod.z.object({
|
|
235
|
+
organizationId: zod.z.string(),
|
|
236
|
+
name: zod.z.string(),
|
|
237
|
+
status: zod.z.enum(["pending_payment", "active", "suspended", "abandoned", "closed"]),
|
|
238
|
+
createdAt: zod.z.string(),
|
|
239
|
+
updatedAt: zod.z.string()
|
|
240
|
+
});
|
|
241
|
+
var organizationListItemSchema = organizationSchema.extend({
|
|
242
|
+
role: organizationRoleSchema
|
|
243
|
+
});
|
|
244
|
+
var organizationMemberSchema = zod.z.object({
|
|
245
|
+
userId: zod.z.string(),
|
|
246
|
+
email: zod.z.string().email(),
|
|
247
|
+
name: zod.z.string(),
|
|
248
|
+
image: zod.z.string().nullable(),
|
|
249
|
+
role: organizationRoleSchema,
|
|
250
|
+
createdAt: zod.z.string(),
|
|
251
|
+
updatedAt: zod.z.string()
|
|
252
|
+
});
|
|
253
|
+
var createOrganizationBodySchema = zod.z.object({
|
|
254
|
+
name: zod.z.string().trim().min(1)
|
|
255
|
+
});
|
|
256
|
+
var updateOrganizationBodySchema = zod.z.object({
|
|
257
|
+
name: zod.z.string().trim().min(1)
|
|
258
|
+
});
|
|
259
|
+
var addOrganizationMemberBodySchema = zod.z.object({
|
|
260
|
+
/** Existing Better Auth user only. This is a membership lookup, never an
|
|
261
|
+
* authentication or account-creation flow. */
|
|
262
|
+
email: zod.z.string().trim().email(),
|
|
263
|
+
role: organizationRoleSchema
|
|
264
|
+
});
|
|
265
|
+
var updateOrganizationMemberBodySchema = zod.z.object({
|
|
266
|
+
role: organizationRoleSchema
|
|
267
|
+
});
|
|
268
|
+
var organizationKeyScopes = [
|
|
269
|
+
"organization:read",
|
|
270
|
+
"delivery:read",
|
|
271
|
+
"delivery:manage",
|
|
272
|
+
"teams:provision",
|
|
273
|
+
"teams:read",
|
|
274
|
+
"teams:manage",
|
|
275
|
+
"teams:keys",
|
|
276
|
+
"esps:read",
|
|
277
|
+
"esps:manage",
|
|
278
|
+
"grants:manage",
|
|
279
|
+
"usage:read"
|
|
280
|
+
];
|
|
281
|
+
var organizationApiKeySchema = zod.z.object({
|
|
282
|
+
keyId: zod.z.string(),
|
|
283
|
+
name: zod.z.string(),
|
|
284
|
+
keyPrefix: zod.z.string(),
|
|
285
|
+
scopes: zod.z.array(zod.z.enum(organizationKeyScopes)),
|
|
286
|
+
expiresAt: zod.z.string().nullable(),
|
|
287
|
+
lastUsedAt: zod.z.string().nullable(),
|
|
288
|
+
revokedAt: zod.z.string().nullable(),
|
|
289
|
+
createdAt: zod.z.string()
|
|
290
|
+
});
|
|
291
|
+
var createOrganizationApiKeyBodySchema = zod.z.object({
|
|
292
|
+
name: zod.z.string().trim().min(1),
|
|
293
|
+
scopes: zod.z.array(zod.z.enum(organizationKeyScopes)).min(1),
|
|
294
|
+
expiresAt: zod.z.string().datetime().nullable().optional()
|
|
295
|
+
});
|
|
296
|
+
var createdOrganizationApiKeySchema = organizationApiKeySchema.extend({
|
|
297
|
+
key: zod.z.string()
|
|
298
|
+
});
|
|
299
|
+
var organizationUsageWindowSchema = zod.z.object({
|
|
300
|
+
limit: zod.z.number().int().nullable(),
|
|
301
|
+
accepted: zod.z.number().int().nonnegative(),
|
|
302
|
+
reserved: zod.z.number().int().nonnegative(),
|
|
303
|
+
remaining: zod.z.number().int().nullable(),
|
|
304
|
+
resetsAt: zod.z.string()
|
|
305
|
+
});
|
|
306
|
+
var organizationUsageSchema = zod.z.object({
|
|
307
|
+
day: organizationUsageWindowSchema,
|
|
308
|
+
month: organizationUsageWindowSchema
|
|
309
|
+
});
|
|
310
|
+
var organizationMailActivityQuerySchema = zod.z.object({
|
|
311
|
+
rangeDays: zod.z.coerce.number().int().refine((value) => [1, 3, 7, 30].includes(value)).optional()
|
|
312
|
+
});
|
|
313
|
+
var organizationMailCountsSchema = zod.z.object({
|
|
314
|
+
sent: zod.z.number().int().nonnegative(),
|
|
315
|
+
queued: zod.z.number().int().nonnegative(),
|
|
316
|
+
failed: zod.z.number().int().nonnegative(),
|
|
317
|
+
bounced: zod.z.number().int().nonnegative()
|
|
318
|
+
});
|
|
319
|
+
var organizationMailActivityTeamSchema = zod.z.object({
|
|
320
|
+
teamId: zod.z.string(),
|
|
321
|
+
name: zod.z.string(),
|
|
322
|
+
status: zod.z.enum(["active", "sending_suspended", "archived"]),
|
|
323
|
+
externalId: zod.z.string().nullable(),
|
|
324
|
+
mail: organizationMailCountsSchema
|
|
325
|
+
});
|
|
326
|
+
var organizationMailActivitySchema = zod.z.object({
|
|
327
|
+
rangeDays: zod.z.union([zod.z.literal(1), zod.z.literal(3), zod.z.literal(7), zod.z.literal(30)]),
|
|
328
|
+
totals: organizationMailCountsSchema,
|
|
329
|
+
teams: zod.z.array(organizationMailActivityTeamSchema)
|
|
330
|
+
});
|
|
331
|
+
var organizationEnterTeamBodySchema = zod.z.object({});
|
|
332
|
+
var organizationEnterTeamResponseSchema = zod.z.object({
|
|
333
|
+
teamId: zod.z.string(),
|
|
334
|
+
role: zod.z.enum(["admin", "member"]),
|
|
335
|
+
created: zod.z.boolean()
|
|
336
|
+
});
|
|
337
|
+
var organizationAuditEventSchema = zod.z.object({
|
|
338
|
+
action: zod.z.string(),
|
|
339
|
+
actorType: zod.z.enum(["user", "organization_key", "team_key", "system"]),
|
|
340
|
+
teamId: zod.z.string().nullable(),
|
|
341
|
+
espId: zod.z.string().nullable(),
|
|
342
|
+
grantId: zod.z.string().nullable(),
|
|
343
|
+
metadata: zod.z.record(zod.z.any()),
|
|
344
|
+
createdAt: zod.z.string()
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// ../api-contract/src/schemas/account.ts
|
|
348
|
+
var accountDeletionBlockerSchema = zod.z.enum([
|
|
349
|
+
"active_subscription_exists",
|
|
350
|
+
"billing_checkout_pending",
|
|
351
|
+
"last_organization_owner",
|
|
352
|
+
"billing_manager_required"
|
|
353
|
+
]);
|
|
354
|
+
var accountDeletionOrganizationSchema = zod.z.object({
|
|
355
|
+
organizationId: zod.z.string(),
|
|
356
|
+
name: zod.z.string(),
|
|
357
|
+
status: zod.z.enum(["pending_payment", "active", "suspended", "abandoned", "closed"]),
|
|
358
|
+
role: organizationRoleSchema,
|
|
359
|
+
/** `delete`: they are its last owner, so it is deleted with its contacts'
|
|
360
|
+
* data. `leave`: someone else stays in charge; only their membership goes. */
|
|
361
|
+
action: zod.z.enum(["delete", "leave"]),
|
|
362
|
+
teamCount: zod.z.number().int(),
|
|
363
|
+
/** What has to happen before the account can be deleted, if anything. */
|
|
364
|
+
blocker: accountDeletionBlockerSchema.nullable()
|
|
365
|
+
});
|
|
366
|
+
var accountDeletionPreviewSchema = zod.z.object({
|
|
367
|
+
email: zod.z.string(),
|
|
368
|
+
organizations: zod.z.array(accountDeletionOrganizationSchema),
|
|
369
|
+
blocked: zod.z.boolean()
|
|
370
|
+
});
|
|
371
|
+
var deleteAccountBodySchema = zod.z.object({
|
|
372
|
+
/** The account's email, typed to confirm. */
|
|
373
|
+
email: zod.z.string().trim().min(1),
|
|
374
|
+
/** The code sent by `POST /account/deletion/code`. */
|
|
375
|
+
code: zod.z.string().trim().min(1)
|
|
376
|
+
});
|
|
377
|
+
var accountDeletionBlockedSchema = accountDeletionPreviewSchema.omit({ email: true }).extend({ error: zod.z.literal("account_deletion_blocked") });
|
|
233
378
|
var paidPlans = ["starter", "pro", "business"];
|
|
234
379
|
var billingPlans = ["oss", "free", ...paidPlans];
|
|
235
380
|
var billingCatalogKeys = paidPlans.flatMap(
|
|
@@ -462,6 +607,50 @@ var emailBlockInputSchema = zod.z.discriminatedUnion("blockType", [
|
|
|
462
607
|
settings: zod.z.object({ src: zod.z.string().min(1) }).passthrough()
|
|
463
608
|
}),
|
|
464
609
|
blockBaseSchema.extend({ blockType: zod.z.literal("separator") }),
|
|
610
|
+
blockBaseSchema.extend({
|
|
611
|
+
blockType: zod.z.literal("spacer"),
|
|
612
|
+
settings: zod.z.object({ height: pixelSchema.optional() }).passthrough()
|
|
613
|
+
}),
|
|
614
|
+
blockBaseSchema.extend({
|
|
615
|
+
blockType: zod.z.literal("columns"),
|
|
616
|
+
settings: zod.z.object({
|
|
617
|
+
left: zod.z.string(),
|
|
618
|
+
right: zod.z.string(),
|
|
619
|
+
ratio: zod.z.enum(["11", "12", "21"]).optional(),
|
|
620
|
+
stack: zod.z.boolean().optional()
|
|
621
|
+
}).passthrough()
|
|
622
|
+
}),
|
|
623
|
+
blockBaseSchema.extend({
|
|
624
|
+
blockType: zod.z.literal("social"),
|
|
625
|
+
settings: zod.z.object({
|
|
626
|
+
links: zod.z.array(
|
|
627
|
+
zod.z.object({
|
|
628
|
+
network: zod.z.enum([
|
|
629
|
+
"website",
|
|
630
|
+
"instagram",
|
|
631
|
+
"linkedin",
|
|
632
|
+
"youtube",
|
|
633
|
+
"x",
|
|
634
|
+
"facebook",
|
|
635
|
+
"tiktok"
|
|
636
|
+
]),
|
|
637
|
+
url: zod.z.string().regex(/^(?:https?:\/\/\S+)?$/i, "Expected an http(s) URL")
|
|
638
|
+
})
|
|
639
|
+
)
|
|
640
|
+
}).passthrough()
|
|
641
|
+
}),
|
|
642
|
+
blockBaseSchema.extend({
|
|
643
|
+
blockType: zod.z.literal("html"),
|
|
644
|
+
settings: zod.z.object({ code: zod.z.string() }).passthrough()
|
|
645
|
+
}),
|
|
646
|
+
blockBaseSchema.extend({
|
|
647
|
+
blockType: zod.z.literal("conditional"),
|
|
648
|
+
settings: zod.z.object({
|
|
649
|
+
tag: zod.z.string().regex(/^[A-Za-z0-9][A-Za-z0-9 _.-]{0,39}$/, "Expected a plain tag name"),
|
|
650
|
+
has: zod.z.boolean().optional(),
|
|
651
|
+
content: zod.z.string()
|
|
652
|
+
}).passthrough()
|
|
653
|
+
}),
|
|
465
654
|
blockBaseSchema.extend({ blockType: zod.z.literal("footer") })
|
|
466
655
|
]);
|
|
467
656
|
var emailMetaInputSchema = zod.z.object({
|
|
@@ -804,6 +993,15 @@ var sequenceEmailSchema = zod.z.object({
|
|
|
804
993
|
/** Hosted content check: `clean`, `review` (held for SendLit's review),
|
|
805
994
|
* `blocked`, or `approved` after review; `null` when not scanned. */
|
|
806
995
|
contentScanVerdict: zod.z.string().nullable().optional(),
|
|
996
|
+
/** Unpublished edits saved while the broadcast or sequence is active. `subject` and
|
|
997
|
+
* `content` above are the published version that sends use. */
|
|
998
|
+
draft: zod.z.object({
|
|
999
|
+
subject: zod.z.string(),
|
|
1000
|
+
content: emailContentSchema,
|
|
1001
|
+
updatedAt: zod.z.string().nullable()
|
|
1002
|
+
}).nullable().optional(),
|
|
1003
|
+
/** Whether `draft` holds changes that aren't published yet. */
|
|
1004
|
+
hasUnpublishedChanges: zod.z.boolean().optional(),
|
|
807
1005
|
createdAt: zod.z.string().nullable(),
|
|
808
1006
|
updatedAt: zod.z.string().nullable()
|
|
809
1007
|
});
|
|
@@ -900,9 +1098,13 @@ var sequenceSchema = zod.z.object({
|
|
|
900
1098
|
/** Whether sends link a hosted web version ("View in browser"). On for
|
|
901
1099
|
* new broadcasts, off for new sequences. */
|
|
902
1100
|
viewInBrowser: zod.z.boolean(),
|
|
1101
|
+
/** When a sent broadcast was archived; `null` when it isn't. */
|
|
1102
|
+
archivedAt: zod.z.string().nullable().optional(),
|
|
903
1103
|
createdAt: zod.z.string().nullable(),
|
|
904
1104
|
updatedAt: zod.z.string().nullable(),
|
|
905
1105
|
emails: zod.z.array(sequenceEmailSchema),
|
|
1106
|
+
/** Whether any of its emails has unpublished changes. */
|
|
1107
|
+
hasUnpublishedChanges: zod.z.boolean().optional(),
|
|
906
1108
|
/** Set while a running broadcast of a new hosted organization is sent
|
|
907
1109
|
* gradually (`get` only). */
|
|
908
1110
|
pacing: zod.z.object({
|
|
@@ -913,8 +1115,12 @@ var sequenceSchema = zod.z.object({
|
|
|
913
1115
|
estimatedCompletionAt: zod.z.string()
|
|
914
1116
|
}).nullable().optional()
|
|
915
1117
|
});
|
|
1118
|
+
var archivedFilters = ["exclude", "only", "include"];
|
|
916
1119
|
var listSequencesQuerySchema = zod.z.object({
|
|
917
1120
|
type: zod.z.enum(mailTypes),
|
|
1121
|
+
archived: zod.z.enum(archivedFilters).optional().describe(
|
|
1122
|
+
"Archived broadcasts: exclude (default) hides them, only lists just them, include lists both"
|
|
1123
|
+
),
|
|
918
1124
|
offset: zod.z.coerce.number().int().min(1).optional(),
|
|
919
1125
|
itemsPerPage: zod.z.coerce.number().int().min(1).max(50).optional()
|
|
920
1126
|
});
|
|
@@ -963,6 +1169,24 @@ var updateSequenceEmailBodySchema = zod.z.object({
|
|
|
963
1169
|
actionData: zod.z.record(zod.z.any()).optional(),
|
|
964
1170
|
published: zod.z.boolean().optional()
|
|
965
1171
|
});
|
|
1172
|
+
var publishScopes = ["in_flight", "new_entrants"];
|
|
1173
|
+
var emailIdsSchema = zod.z.array(zod.z.string()).min(1).optional().describe("The emails to act on; omit for every email with unpublished changes");
|
|
1174
|
+
var publishSequenceChangesBodySchema = zod.z.object({
|
|
1175
|
+
emailIds: emailIdsSchema,
|
|
1176
|
+
scope: zod.z.enum(publishScopes).optional().describe(
|
|
1177
|
+
"Sequences only. in_flight (default): contacts already in the sequence get the new version at their next step. new_entrants: they keep the version they entered with; only contacts who enter from now on get the new one."
|
|
1178
|
+
)
|
|
1179
|
+
});
|
|
1180
|
+
var discardSequenceChangesBodySchema = zod.z.object({
|
|
1181
|
+
emailIds: emailIdsSchema
|
|
1182
|
+
});
|
|
1183
|
+
var sequenceEmailVersionSchema = zod.z.object({
|
|
1184
|
+
versionId: zod.z.string(),
|
|
1185
|
+
subject: zod.z.string(),
|
|
1186
|
+
content: emailContentSchema,
|
|
1187
|
+
publishedAt: zod.z.string().describe("When this version last went live"),
|
|
1188
|
+
live: zod.z.boolean().describe("Whether sends use this version now")
|
|
1189
|
+
});
|
|
966
1190
|
var sendSequenceEmailTestBodySchema = zod.z.object({
|
|
967
1191
|
to: zod.z.array(zod.z.string().email()).max(5).optional().describe(
|
|
968
1192
|
"Up to 5 addresses. Defaults to the signed-in user's address; API keys must set it."
|
|
@@ -985,6 +1209,42 @@ var sequenceStatsSchema = zod.z.object({
|
|
|
985
1209
|
bounceRate: zod.z.number().optional(),
|
|
986
1210
|
complaintRate: zod.z.number().optional()
|
|
987
1211
|
});
|
|
1212
|
+
var sequenceScheduleSchema = zod.z.object({
|
|
1213
|
+
waiting: zod.z.number().describe("Contacts in the sequence who are waiting for their next email"),
|
|
1214
|
+
emails: zod.z.array(
|
|
1215
|
+
zod.z.object({
|
|
1216
|
+
emailId: zod.z.string(),
|
|
1217
|
+
waiting: zod.z.number().describe("Contacts whose next email is this one"),
|
|
1218
|
+
nextSendAt: zod.z.number().nullable().describe(
|
|
1219
|
+
"The earliest due time among them (epoch millis), not a time they share: each contact's delay counts from their own entry. null when no one is waiting"
|
|
1220
|
+
)
|
|
1221
|
+
})
|
|
1222
|
+
)
|
|
1223
|
+
});
|
|
1224
|
+
var waitingContactSchema = zod.z.object({
|
|
1225
|
+
contactId: zod.z.string(),
|
|
1226
|
+
email: zod.z.string(),
|
|
1227
|
+
name: zod.z.string().nullable(),
|
|
1228
|
+
nextSendAt: zod.z.number().describe("When this contact is due to get the email (epoch millis)")
|
|
1229
|
+
});
|
|
1230
|
+
var listWaitingContactsQuerySchema = zod.z.object({
|
|
1231
|
+
after: zod.z.string().optional().describe("The previous page's `nextCursor`; omit for the first page"),
|
|
1232
|
+
limit: zod.z.coerce.number().int().min(1).max(100).optional(),
|
|
1233
|
+
q: zod.z.string().optional().describe("Matches the contact's email or name")
|
|
1234
|
+
});
|
|
1235
|
+
var waitingContactsPageSchema = zod.z.object({
|
|
1236
|
+
items: zod.z.array(waitingContactSchema),
|
|
1237
|
+
total: zod.z.number().describe("Every waiting contact that matches, across all pages"),
|
|
1238
|
+
nextCursor: zod.z.string().nullable().describe("Pass as `after` for the next page; null on the last page")
|
|
1239
|
+
});
|
|
1240
|
+
var sequenceDeletionPreviewSchema = zod.z.object({
|
|
1241
|
+
status: zod.z.string().describe("The broadcast or sequence's current status"),
|
|
1242
|
+
blocker: zod.z.enum(["sequence_active", "broadcast_sent"]).nullable().describe(
|
|
1243
|
+
"Why it can't be deleted right now (sequence_active: pause it first; broadcast_sent: archive the broadcast instead), or null when it can"
|
|
1244
|
+
),
|
|
1245
|
+
enrolledCount: zod.z.number().int().describe("Contacts currently in the sequence; deleting it stops their emails"),
|
|
1246
|
+
emailsSentCount: zod.z.number().int().describe("Emails it has sent; their delivery, open and click history is deleted")
|
|
1247
|
+
});
|
|
988
1248
|
var listSubscribersQuerySchema = zod.z.object({
|
|
989
1249
|
page: zod.z.coerce.number().int().min(1).optional(),
|
|
990
1250
|
limit: zod.z.coerce.number().int().min(1).optional()
|
|
@@ -1082,6 +1342,46 @@ var exportContactsQuerySchema = zod.z.object({
|
|
|
1082
1342
|
segmentId: zod.z.string().optional().describe("Only export this saved segment"),
|
|
1083
1343
|
filter: zod.z.string().optional().describe("Serialized ContactFilterWithAggregator JSON; combines with segmentId")
|
|
1084
1344
|
});
|
|
1345
|
+
var contactSelectionObjectSchema = zod.z.object({
|
|
1346
|
+
contactIds: zod.z.array(zod.z.string().min(1)).min(1).max(1e3).optional().describe("Contact IDs, up to 1000. Unknown IDs are ignored."),
|
|
1347
|
+
match: zod.z.object({
|
|
1348
|
+
q: zod.z.string().optional().describe("Search term matched against email or name"),
|
|
1349
|
+
segmentId: zod.z.string().optional().describe("Only contacts in this saved segment"),
|
|
1350
|
+
filter: contactFilterSchema.optional().describe("Inline ContactFilterWithAggregator; combines with q and segmentId")
|
|
1351
|
+
}).optional().describe(
|
|
1352
|
+
"Every contact matching q, segmentId and filter (AND). `{}` selects every contact in the team."
|
|
1353
|
+
)
|
|
1354
|
+
});
|
|
1355
|
+
var exactlyOneSelection = (body) => Boolean(body.contactIds) !== Boolean(body.match);
|
|
1356
|
+
var exactlyOneSelectionMessage = {
|
|
1357
|
+
message: "Pass exactly one of contactIds or match"
|
|
1358
|
+
};
|
|
1359
|
+
var contactSelectionSchema = contactSelectionObjectSchema.refine(
|
|
1360
|
+
exactlyOneSelection,
|
|
1361
|
+
exactlyOneSelectionMessage
|
|
1362
|
+
);
|
|
1363
|
+
var previewContactDeletionResultSchema = zod.z.object({
|
|
1364
|
+
count: zod.z.number().int().describe("Contacts that would be deleted right now"),
|
|
1365
|
+
unsubscribed: zod.z.number().int().describe(
|
|
1366
|
+
"How many of them are unsubscribed; their addresses are added to the suppression list"
|
|
1367
|
+
)
|
|
1368
|
+
});
|
|
1369
|
+
var deleteContactsObjectSchema = contactSelectionObjectSchema.extend({
|
|
1370
|
+
expectedCount: zod.z.number().int().min(0).optional().describe(
|
|
1371
|
+
"The count from the preview. Required with match: if the live count differs, nothing is deleted and the response is 409 count_changed."
|
|
1372
|
+
)
|
|
1373
|
+
});
|
|
1374
|
+
var deleteContactsBodySchema = deleteContactsObjectSchema.refine(exactlyOneSelection, exactlyOneSelectionMessage).refine((body) => !body.match || body.expectedCount !== void 0, {
|
|
1375
|
+
message: "expectedCount is required with match",
|
|
1376
|
+
path: ["expectedCount"]
|
|
1377
|
+
});
|
|
1378
|
+
var contactDeletionSchema = zod.z.object({
|
|
1379
|
+
deletionId: zod.z.string().nullable().describe("Background job id for large deletions; null when it ran inline"),
|
|
1380
|
+
status: zod.z.enum(["queued", "running", "completed", "failed"]),
|
|
1381
|
+
count: zod.z.number().int().describe("Contacts selected for deletion"),
|
|
1382
|
+
deleted: zod.z.number().int().describe("Contacts deleted so far"),
|
|
1383
|
+
suppressed: zod.z.number().int().describe("Unsubscribed addresses newly added to the suppression list")
|
|
1384
|
+
});
|
|
1085
1385
|
var deliveryEventType = [
|
|
1086
1386
|
"accepted",
|
|
1087
1387
|
"delivered",
|
|
@@ -1301,6 +1601,14 @@ var testFeedbackConnectionResponseSchema = zod.z.object({
|
|
|
1301
1601
|
success: zod.z.boolean(),
|
|
1302
1602
|
error: zod.z.string().optional()
|
|
1303
1603
|
});
|
|
1604
|
+
var feedbackRequirementSchema = zod.z.object({
|
|
1605
|
+
/** False on self-hosted SendLit, where the rule doesn't apply. */
|
|
1606
|
+
required: zod.z.boolean(),
|
|
1607
|
+
/** Emails the organization can send before the rule applies. */
|
|
1608
|
+
requiredAfterSends: zod.z.number().int(),
|
|
1609
|
+
/** Emails the organization has sent so far, across all its teams. */
|
|
1610
|
+
sentSoFar: zod.z.number().int()
|
|
1611
|
+
});
|
|
1304
1612
|
var signupFormSchema = zod.z.object({
|
|
1305
1613
|
formId: zod.z.string(),
|
|
1306
1614
|
name: zod.z.string(),
|
|
@@ -1343,7 +1651,7 @@ var mediaSchema = zod.z.object({
|
|
|
1343
1651
|
updatedAt: zod.z.string().or(zod.z.date()).nullable().optional()
|
|
1344
1652
|
});
|
|
1345
1653
|
var mediaReferenceSchema = zod.z.object({
|
|
1346
|
-
resourceType: zod.z.enum(["TEMPLATE", "SEQUENCE_EMAIL"]),
|
|
1654
|
+
resourceType: zod.z.enum(["TEMPLATE", "SEQUENCE_EMAIL", "BROADCAST_WEB_PAGE"]),
|
|
1347
1655
|
resourcePublicId: zod.z.string(),
|
|
1348
1656
|
parentResourcePublicId: zod.z.string().nullable().optional(),
|
|
1349
1657
|
createdAt: zod.z.string().or(zod.z.date()).nullable().optional(),
|
|
@@ -1362,116 +1670,6 @@ var mediaUploadSignatureSchema = zod.z.object({
|
|
|
1362
1670
|
signature: zod.z.string(),
|
|
1363
1671
|
endpoint: zod.z.string()
|
|
1364
1672
|
});
|
|
1365
|
-
var organizationRoleSchema = zod.z.enum(["owner", "admin", "member"]);
|
|
1366
|
-
var organizationSchema = zod.z.object({
|
|
1367
|
-
organizationId: zod.z.string(),
|
|
1368
|
-
name: zod.z.string(),
|
|
1369
|
-
status: zod.z.enum(["pending_payment", "active", "suspended", "abandoned", "closed"]),
|
|
1370
|
-
createdAt: zod.z.string(),
|
|
1371
|
-
updatedAt: zod.z.string()
|
|
1372
|
-
});
|
|
1373
|
-
var organizationMemberSchema = zod.z.object({
|
|
1374
|
-
userId: zod.z.string(),
|
|
1375
|
-
email: zod.z.string().email(),
|
|
1376
|
-
name: zod.z.string(),
|
|
1377
|
-
image: zod.z.string().nullable(),
|
|
1378
|
-
role: organizationRoleSchema,
|
|
1379
|
-
createdAt: zod.z.string(),
|
|
1380
|
-
updatedAt: zod.z.string()
|
|
1381
|
-
});
|
|
1382
|
-
var createOrganizationBodySchema = zod.z.object({
|
|
1383
|
-
name: zod.z.string().trim().min(1)
|
|
1384
|
-
});
|
|
1385
|
-
var updateOrganizationBodySchema = zod.z.object({
|
|
1386
|
-
name: zod.z.string().trim().min(1)
|
|
1387
|
-
});
|
|
1388
|
-
var addOrganizationMemberBodySchema = zod.z.object({
|
|
1389
|
-
/** Existing Better Auth user only. This is a membership lookup, never an
|
|
1390
|
-
* authentication or account-creation flow. */
|
|
1391
|
-
email: zod.z.string().trim().email(),
|
|
1392
|
-
role: organizationRoleSchema
|
|
1393
|
-
});
|
|
1394
|
-
var updateOrganizationMemberBodySchema = zod.z.object({
|
|
1395
|
-
role: organizationRoleSchema
|
|
1396
|
-
});
|
|
1397
|
-
var organizationKeyScopes = [
|
|
1398
|
-
"organization:read",
|
|
1399
|
-
"delivery:read",
|
|
1400
|
-
"delivery:manage",
|
|
1401
|
-
"teams:provision",
|
|
1402
|
-
"teams:read",
|
|
1403
|
-
"teams:manage",
|
|
1404
|
-
"teams:keys",
|
|
1405
|
-
"esps:read",
|
|
1406
|
-
"esps:manage",
|
|
1407
|
-
"grants:manage",
|
|
1408
|
-
"usage:read"
|
|
1409
|
-
];
|
|
1410
|
-
var organizationApiKeySchema = zod.z.object({
|
|
1411
|
-
keyId: zod.z.string(),
|
|
1412
|
-
name: zod.z.string(),
|
|
1413
|
-
keyPrefix: zod.z.string(),
|
|
1414
|
-
scopes: zod.z.array(zod.z.enum(organizationKeyScopes)),
|
|
1415
|
-
expiresAt: zod.z.string().nullable(),
|
|
1416
|
-
lastUsedAt: zod.z.string().nullable(),
|
|
1417
|
-
revokedAt: zod.z.string().nullable(),
|
|
1418
|
-
createdAt: zod.z.string()
|
|
1419
|
-
});
|
|
1420
|
-
var createOrganizationApiKeyBodySchema = zod.z.object({
|
|
1421
|
-
name: zod.z.string().trim().min(1),
|
|
1422
|
-
scopes: zod.z.array(zod.z.enum(organizationKeyScopes)).min(1),
|
|
1423
|
-
expiresAt: zod.z.string().datetime().nullable().optional()
|
|
1424
|
-
});
|
|
1425
|
-
var createdOrganizationApiKeySchema = organizationApiKeySchema.extend({
|
|
1426
|
-
key: zod.z.string()
|
|
1427
|
-
});
|
|
1428
|
-
var organizationUsageWindowSchema = zod.z.object({
|
|
1429
|
-
limit: zod.z.number().int().nullable(),
|
|
1430
|
-
accepted: zod.z.number().int().nonnegative(),
|
|
1431
|
-
reserved: zod.z.number().int().nonnegative(),
|
|
1432
|
-
remaining: zod.z.number().int().nullable(),
|
|
1433
|
-
resetsAt: zod.z.string()
|
|
1434
|
-
});
|
|
1435
|
-
var organizationUsageSchema = zod.z.object({
|
|
1436
|
-
day: organizationUsageWindowSchema,
|
|
1437
|
-
month: organizationUsageWindowSchema
|
|
1438
|
-
});
|
|
1439
|
-
var organizationMailActivityQuerySchema = zod.z.object({
|
|
1440
|
-
rangeDays: zod.z.coerce.number().int().refine((value) => [1, 3, 7, 30].includes(value)).optional()
|
|
1441
|
-
});
|
|
1442
|
-
var organizationMailCountsSchema = zod.z.object({
|
|
1443
|
-
sent: zod.z.number().int().nonnegative(),
|
|
1444
|
-
queued: zod.z.number().int().nonnegative(),
|
|
1445
|
-
failed: zod.z.number().int().nonnegative(),
|
|
1446
|
-
bounced: zod.z.number().int().nonnegative()
|
|
1447
|
-
});
|
|
1448
|
-
var organizationMailActivityTeamSchema = zod.z.object({
|
|
1449
|
-
teamId: zod.z.string(),
|
|
1450
|
-
name: zod.z.string(),
|
|
1451
|
-
status: zod.z.enum(["active", "sending_suspended", "archived"]),
|
|
1452
|
-
externalId: zod.z.string().nullable(),
|
|
1453
|
-
mail: organizationMailCountsSchema
|
|
1454
|
-
});
|
|
1455
|
-
var organizationMailActivitySchema = zod.z.object({
|
|
1456
|
-
rangeDays: zod.z.union([zod.z.literal(1), zod.z.literal(3), zod.z.literal(7), zod.z.literal(30)]),
|
|
1457
|
-
totals: organizationMailCountsSchema,
|
|
1458
|
-
teams: zod.z.array(organizationMailActivityTeamSchema)
|
|
1459
|
-
});
|
|
1460
|
-
var organizationEnterTeamBodySchema = zod.z.object({});
|
|
1461
|
-
var organizationEnterTeamResponseSchema = zod.z.object({
|
|
1462
|
-
teamId: zod.z.string(),
|
|
1463
|
-
role: zod.z.enum(["admin", "member"]),
|
|
1464
|
-
created: zod.z.boolean()
|
|
1465
|
-
});
|
|
1466
|
-
var organizationAuditEventSchema = zod.z.object({
|
|
1467
|
-
action: zod.z.string(),
|
|
1468
|
-
actorType: zod.z.enum(["user", "organization_key", "team_key", "system"]),
|
|
1469
|
-
teamId: zod.z.string().nullable(),
|
|
1470
|
-
espId: zod.z.string().nullable(),
|
|
1471
|
-
grantId: zod.z.string().nullable(),
|
|
1472
|
-
metadata: zod.z.record(zod.z.any()),
|
|
1473
|
-
createdAt: zod.z.string()
|
|
1474
|
-
});
|
|
1475
1673
|
var overviewQuerySchema = zod.z.object({
|
|
1476
1674
|
/** Delivery activity window, in days. Defaults to the last 7 days. */
|
|
1477
1675
|
rangeDays: zod.z.coerce.number().int().refine((value) => [1, 3, 7, 30].includes(value)).optional()
|
|
@@ -1634,6 +1832,47 @@ var createSuppressionBodySchema = zod.z.object({
|
|
|
1634
1832
|
"Why the address is blocked, e.g. a legal request; kept in the audit trail"
|
|
1635
1833
|
)
|
|
1636
1834
|
});
|
|
1835
|
+
var tagSummarySchema = zod.z.object({
|
|
1836
|
+
tag: zod.z.string(),
|
|
1837
|
+
contactCount: zod.z.number().int()
|
|
1838
|
+
});
|
|
1839
|
+
var tagSequenceUsageSchema = zod.z.enum([
|
|
1840
|
+
"filter",
|
|
1841
|
+
"exclude_filter",
|
|
1842
|
+
"trigger",
|
|
1843
|
+
"email_action"
|
|
1844
|
+
]);
|
|
1845
|
+
var tagReferencesSchema = zod.z.object({
|
|
1846
|
+
tag: zod.z.string(),
|
|
1847
|
+
contactCount: zod.z.number().int(),
|
|
1848
|
+
segments: zod.z.array(zod.z.object({ segmentId: zod.z.string(), name: zod.z.string() })),
|
|
1849
|
+
sequences: zod.z.array(
|
|
1850
|
+
zod.z.object({
|
|
1851
|
+
sequenceId: zod.z.string(),
|
|
1852
|
+
title: zod.z.string(),
|
|
1853
|
+
type: zod.z.enum(["broadcast", "sequence"]),
|
|
1854
|
+
status: zod.z.string(),
|
|
1855
|
+
usages: zod.z.array(tagSequenceUsageSchema)
|
|
1856
|
+
})
|
|
1857
|
+
),
|
|
1858
|
+
signupForms: zod.z.array(zod.z.object({ formId: zod.z.string(), name: zod.z.string() }))
|
|
1859
|
+
});
|
|
1860
|
+
var renameTagBodySchema = zod.z.object({
|
|
1861
|
+
name: zod.z.string().trim().min(1).describe("The tag's new name")
|
|
1862
|
+
});
|
|
1863
|
+
var renameTagResultSchema = zod.z.object({
|
|
1864
|
+
tag: zod.z.string(),
|
|
1865
|
+
previousTag: zod.z.string(),
|
|
1866
|
+
contactsUpdated: zod.z.number().int(),
|
|
1867
|
+
segmentsUpdated: zod.z.number().int(),
|
|
1868
|
+
sequencesUpdated: zod.z.number().int(),
|
|
1869
|
+
signupFormsUpdated: zod.z.number().int()
|
|
1870
|
+
});
|
|
1871
|
+
var deleteTagResultSchema = zod.z.object({
|
|
1872
|
+
tag: zod.z.string(),
|
|
1873
|
+
contactsUpdated: zod.z.number().int(),
|
|
1874
|
+
references: tagReferencesSchema
|
|
1875
|
+
});
|
|
1637
1876
|
var teamSchema = zod.z.object({
|
|
1638
1877
|
teamId: zod.z.string(),
|
|
1639
1878
|
/** Public organization identifier. Present when an end user lists the
|
|
@@ -1887,7 +2126,7 @@ var webPublishingSchema = zod.z.object({
|
|
|
1887
2126
|
ogImage: zod.z.string().nullable(),
|
|
1888
2127
|
noindex: zod.z.boolean(),
|
|
1889
2128
|
canonicalUrl: zod.z.string().nullable(),
|
|
1890
|
-
/** Published and
|
|
2129
|
+
/** Published, already sent and not archived, so the page is public. */
|
|
1891
2130
|
live: zod.z.boolean(),
|
|
1892
2131
|
/** When the issue was sent; `null` until then. */
|
|
1893
2132
|
publishedAt: zod.z.string().nullable(),
|
|
@@ -1899,7 +2138,9 @@ var updateWebPublishingBodySchema = zod.z.object({
|
|
|
1899
2138
|
slug: webSlugSchema.optional().describe("URL slug; defaults to one made from the title"),
|
|
1900
2139
|
seoTitle: zod.z.string().trim().max(200).nullable().optional(),
|
|
1901
2140
|
seoDescription: zod.z.string().trim().max(500).nullable().optional(),
|
|
1902
|
-
ogImage: httpUrl.nullable().optional().describe(
|
|
2141
|
+
ogImage: httpUrl.nullable().optional().describe(
|
|
2142
|
+
"Image for social previews. An image uploaded to MediaLit is added to the media library and can't be deleted while the page uses it"
|
|
2143
|
+
),
|
|
1903
2144
|
noindex: zod.z.boolean().optional().describe("Ask search engines not to index the page"),
|
|
1904
2145
|
canonicalUrl: httpUrl.nullable().optional().describe("Canonical URL, when a platform hosts the issue on its own site")
|
|
1905
2146
|
});
|
|
@@ -1993,6 +2234,39 @@ var contactsContract = c.router(
|
|
|
1993
2234
|
summary: "Export contacts as CSV",
|
|
1994
2235
|
description: "Returns every contact, or those matching segmentId and/or filter, as CSV: email, name, status (subscribed, unsubscribed, bounced or complained), tags, created_at, suppression_reason, then one column per custom field."
|
|
1995
2236
|
},
|
|
2237
|
+
previewBulkDelete: {
|
|
2238
|
+
method: "POST",
|
|
2239
|
+
path: "/contacts/bulk-delete/preview",
|
|
2240
|
+
body: contactSelectionSchema,
|
|
2241
|
+
responses: {
|
|
2242
|
+
200: previewContactDeletionResultSchema,
|
|
2243
|
+
400: errorSchema,
|
|
2244
|
+
404: errorSchema
|
|
2245
|
+
},
|
|
2246
|
+
summary: "Preview a bulk contact deletion",
|
|
2247
|
+
description: "Counts the contacts a bulk delete would remove (and how many are unsubscribed) without deleting anything. Pass the count to bulkDelete as expectedCount. 404 when segmentId doesn't exist."
|
|
2248
|
+
},
|
|
2249
|
+
bulkDelete: {
|
|
2250
|
+
method: "POST",
|
|
2251
|
+
path: "/contacts/bulk-delete",
|
|
2252
|
+
body: deleteContactsBodySchema,
|
|
2253
|
+
responses: {
|
|
2254
|
+
200: contactDeletionSchema,
|
|
2255
|
+
202: contactDeletionSchema,
|
|
2256
|
+
400: errorSchema,
|
|
2257
|
+
404: errorSchema,
|
|
2258
|
+
409: errorSchema.extend({ count: zod.z.number().int().optional() })
|
|
2259
|
+
},
|
|
2260
|
+
summary: "Delete contacts in bulk",
|
|
2261
|
+
description: "Permanently deletes up to 1000 contacts by id, or every contact matching q, segmentId and filter. With match, pass the preview's count as expectedCount; if the live count differs nothing is deleted (409 count_changed, with the new count). Only contacts that existed when the request arrived are deleted. Up to 1000 contacts are deleted before the response (200, status completed); larger selections run in the background (202, status queued) and report progress at GET /contacts/bulk-delete/{deletionId}. Each contact's custom field values, sequence progress, events and delivery records are deleted with it, and no sequence triggers fire. Suppressions are kept, and the address of every deleted unsubscribed contact is added to the suppression list (reason manual), so re-importing or re-adding it never mails it again. This is not a full privacy erasure: delivery logs and the suppression list keep the address."
|
|
2262
|
+
},
|
|
2263
|
+
bulkDeleteStatus: {
|
|
2264
|
+
method: "GET",
|
|
2265
|
+
path: "/contacts/bulk-delete/:deletionId",
|
|
2266
|
+
responses: { 200: contactDeletionSchema, 404: errorSchema },
|
|
2267
|
+
summary: "Get a bulk contact deletion",
|
|
2268
|
+
description: "Progress of a background bulk delete. Finished deletions are kept for 24 hours."
|
|
2269
|
+
},
|
|
1996
2270
|
get: {
|
|
1997
2271
|
method: "GET",
|
|
1998
2272
|
path: "/contacts/:contactId",
|
|
@@ -2050,6 +2324,45 @@ var contactsContract = c.router(
|
|
|
2050
2324
|
},
|
|
2051
2325
|
{ metadata: { tag: "Contacts" } }
|
|
2052
2326
|
);
|
|
2327
|
+
var tagsContract = c.router(
|
|
2328
|
+
{
|
|
2329
|
+
list: {
|
|
2330
|
+
method: "GET",
|
|
2331
|
+
path: "/tags",
|
|
2332
|
+
responses: { 200: itemsList(tagSummarySchema) },
|
|
2333
|
+
summary: "List tags",
|
|
2334
|
+
description: "Returns every tag carried by at least one of the team's contacts, sorted by name, with the number of contacts that carry it."
|
|
2335
|
+
},
|
|
2336
|
+
references: {
|
|
2337
|
+
method: "GET",
|
|
2338
|
+
path: "/tags/:tag/references",
|
|
2339
|
+
responses: { 200: tagReferencesSchema },
|
|
2340
|
+
summary: "List where a tag is used",
|
|
2341
|
+
description: "Returns how many contacts carry the tag and the segments, broadcasts, sequences (audience filters, tag triggers, email tag actions) and signup forms that name it. Call it before deleting a tag."
|
|
2342
|
+
},
|
|
2343
|
+
rename: {
|
|
2344
|
+
method: "PATCH",
|
|
2345
|
+
path: "/tags/:tag",
|
|
2346
|
+
body: renameTagBodySchema,
|
|
2347
|
+
responses: {
|
|
2348
|
+
200: renameTagResultSchema,
|
|
2349
|
+
400: errorSchema,
|
|
2350
|
+
404: errorSchema
|
|
2351
|
+
},
|
|
2352
|
+
summary: "Rename a tag",
|
|
2353
|
+
description: "Renames the tag on every contact, and in segments, broadcast and sequence filters and tag triggers, sequence email tag actions and signup forms. Renaming to a tag that already exists merges the two. Sent broadcasts keep their original filters. Renaming doesn't trigger tag-added or tag-removed sequences. 404 `tag_not_found` when nothing uses the tag; 400 `tag_unchanged` when the new name is the same."
|
|
2354
|
+
},
|
|
2355
|
+
remove: {
|
|
2356
|
+
method: "DELETE",
|
|
2357
|
+
path: "/tags/:tag",
|
|
2358
|
+
body: c.noBody(),
|
|
2359
|
+
responses: { 200: deleteTagResultSchema, 404: errorSchema },
|
|
2360
|
+
summary: "Delete a tag from every contact",
|
|
2361
|
+
description: "Removes the tag from every contact of the team. Segments, filters, triggers, email actions and signup forms that name the tag are left as they are and returned in `references`: a filter on a deleted tag matches nobody, and a trigger or form can add it again. Check `GET /tags/:tag/references` first. Deleting doesn't trigger tag-removed sequences. 404 `tag_not_found` when nothing uses the tag."
|
|
2362
|
+
}
|
|
2363
|
+
},
|
|
2364
|
+
{ metadata: { tag: "Tags" } }
|
|
2365
|
+
);
|
|
2053
2366
|
var segmentsContract = c.router(
|
|
2054
2367
|
{
|
|
2055
2368
|
create: {
|
|
@@ -2215,7 +2528,8 @@ var templatesContract = c.router(
|
|
|
2215
2528
|
method: "DELETE",
|
|
2216
2529
|
path: "/templates/:templateId",
|
|
2217
2530
|
responses: { 204: c.noBody() },
|
|
2218
|
-
summary: "Delete an email template"
|
|
2531
|
+
summary: "Delete an email template",
|
|
2532
|
+
description: "Permanently deletes the template. Its images that no other template or email uses are deleted from the media library and storage, unless a transactional email was sent with the template."
|
|
2219
2533
|
}
|
|
2220
2534
|
},
|
|
2221
2535
|
{ metadata: { tag: "Templates" } }
|
|
@@ -2239,7 +2553,8 @@ var sequencesContract = c.router(
|
|
|
2239
2553
|
path: "/sequences",
|
|
2240
2554
|
query: listSequencesQuerySchema,
|
|
2241
2555
|
responses: { 200: paginated(sequenceSchema) },
|
|
2242
|
-
summary: "List broadcasts or sequences"
|
|
2556
|
+
summary: "List broadcasts or sequences",
|
|
2557
|
+
description: "Archived broadcasts are left out unless `archived` is `only` or `include`."
|
|
2243
2558
|
},
|
|
2244
2559
|
get: {
|
|
2245
2560
|
method: "GET",
|
|
@@ -2257,13 +2572,37 @@ var sequencesContract = c.router(
|
|
|
2257
2572
|
404: errorSchema
|
|
2258
2573
|
},
|
|
2259
2574
|
summary: "Update a broadcast or sequence",
|
|
2260
|
-
description: "A broadcast's title is its email's subject,
|
|
2575
|
+
description: "A broadcast's title is its email's published subject. While it's scheduled, a new title is saved as the email's draft subject (see `draft`) and becomes the title when the changes are published. Once the broadcast has been sent, changing the title returns 400 with the error \"This broadcast has already been sent\". `viewInBrowser` can be changed at any time; turning it off also takes down the web versions linked from emails already sent."
|
|
2261
2576
|
},
|
|
2262
2577
|
remove: {
|
|
2263
2578
|
method: "DELETE",
|
|
2264
2579
|
path: "/sequences/:sequenceId",
|
|
2265
|
-
responses: { 204: c.noBody(), 404: errorSchema },
|
|
2266
|
-
summary: "Delete a broadcast or sequence"
|
|
2580
|
+
responses: { 204: c.noBody(), 404: errorSchema, 409: errorSchema },
|
|
2581
|
+
summary: "Delete a broadcast or sequence",
|
|
2582
|
+
description: "Permanently deletes the broadcast or sequence, its emails and triggers. An active sequence or a sending broadcast can't be deleted: pause it first (409 `sequence_active`). A draft or scheduled broadcast can be deleted; one that has started sending can't (409 `broadcast_sent`): archive it instead with POST /sequences/{sequenceId}/archive. Contacts still enrolled in a paused sequence leave it, and its delivery, open and click history is deleted too, so its stats are gone; check GET /sequences/{sequenceId}/deletion-preview first. The outbound message log and suppressions are kept. Images it uses that nothing else uses are deleted from the media library and storage; images used by sent mail are kept."
|
|
2583
|
+
},
|
|
2584
|
+
deletionPreview: {
|
|
2585
|
+
method: "GET",
|
|
2586
|
+
path: "/sequences/:sequenceId/deletion-preview",
|
|
2587
|
+
responses: { 200: sequenceDeletionPreviewSchema, 404: errorSchema },
|
|
2588
|
+
summary: "Preview what deleting a broadcast or sequence removes",
|
|
2589
|
+
description: "How many contacts are enrolled and how many emails it has sent, and whether it can be deleted right now. Nothing is changed."
|
|
2590
|
+
},
|
|
2591
|
+
archive: {
|
|
2592
|
+
method: "POST",
|
|
2593
|
+
path: "/sequences/:sequenceId/archive",
|
|
2594
|
+
body: c.noBody(),
|
|
2595
|
+
responses: { 200: sequenceSchema, 404: errorSchema, 409: errorSchema },
|
|
2596
|
+
summary: "Archive a sent broadcast",
|
|
2597
|
+
description: 'Hides a sent broadcast from the broadcasts list (see `archived` on GET /sequences) and from the public web archive, its feed and sitemap. Its report, delivery history and images are kept, and recipients\' "view in browser" links keep working. 409 `broadcast_not_sent` for a draft or scheduled broadcast (delete it instead) and `sequence_active` while it is sending. Archiving an archived broadcast changes nothing. 404 for sequences.'
|
|
2598
|
+
},
|
|
2599
|
+
unarchive: {
|
|
2600
|
+
method: "POST",
|
|
2601
|
+
path: "/sequences/:sequenceId/unarchive",
|
|
2602
|
+
body: c.noBody(),
|
|
2603
|
+
responses: { 200: sequenceSchema, 404: errorSchema },
|
|
2604
|
+
summary: "Restore an archived broadcast",
|
|
2605
|
+
description: "Puts an archived broadcast back in the broadcasts list, and back on the web archive when it is published there."
|
|
2267
2606
|
},
|
|
2268
2607
|
addEmail: {
|
|
2269
2608
|
method: "POST",
|
|
@@ -2289,7 +2628,50 @@ var sequencesContract = c.router(
|
|
|
2289
2628
|
422: templateNotMarketingErrorSchema
|
|
2290
2629
|
},
|
|
2291
2630
|
summary: "Update an email within a sequence",
|
|
2292
|
-
description:
|
|
2631
|
+
description: "When templateId is supplied, it must identify a marketing template; transactional templates return 422 template_not_marketing. While a broadcast or sequence is active (a running sequence or a scheduled broadcast), `subject` and `content` are saved as a draft (returned as the email's `draft`) and sends keep using the published version until the changes are published with POST /sequences/{sequenceId}/publish-changes. Otherwise nothing is sending, so they're saved directly, along with any open draft. Delay, published and tag action changes always apply right away. The \"view in browser\" page of an email already sent keeps showing what was sent. A sent broadcast can't be edited; the request returns it unchanged."
|
|
2632
|
+
},
|
|
2633
|
+
publishChanges: {
|
|
2634
|
+
method: "POST",
|
|
2635
|
+
path: "/sequences/:sequenceId/publish-changes",
|
|
2636
|
+
body: publishSequenceChangesBodySchema,
|
|
2637
|
+
responses: {
|
|
2638
|
+
200: sequenceSchema,
|
|
2639
|
+
400: errorSchema,
|
|
2640
|
+
404: errorSchema,
|
|
2641
|
+
409: errorSchema
|
|
2642
|
+
},
|
|
2643
|
+
summary: "Publish the unpublished changes of a broadcast or sequence",
|
|
2644
|
+
description: "Makes the drafts of the given emails (or all of them) the version that sends use. Emails without unpublished changes are left alone, so publishing twice changes nothing. For a sequence, `scope` says whether contacts already in it get the new version at their next step (`in_flight`, the default) or keep the version they entered with (`new_entrants`). Each published version is kept in the email's history (GET /sequences/{sequenceId}/emails/{emailId}/versions), including the one it replaces. On SendLit Cloud the content is checked first, as when a sequence starts. 404 `email_not_found` for an email the sequence doesn't have; 409 `mail_already_sent` for a broadcast that has started sending (its unpublished changes are dropped then); 409 `draft_changed` when the draft was edited during the publish (publish again)."
|
|
2645
|
+
},
|
|
2646
|
+
discardChanges: {
|
|
2647
|
+
method: "POST",
|
|
2648
|
+
path: "/sequences/:sequenceId/discard-changes",
|
|
2649
|
+
body: discardSequenceChangesBodySchema,
|
|
2650
|
+
responses: { 200: sequenceSchema, 404: errorSchema },
|
|
2651
|
+
summary: "Discard the unpublished changes of a broadcast or sequence",
|
|
2652
|
+
description: "Deletes the drafts of the given emails (or all of them), so they show the published version again. A broadcast's title goes back to its published subject. Sends are not affected."
|
|
2653
|
+
},
|
|
2654
|
+
emailVersions: {
|
|
2655
|
+
method: "GET",
|
|
2656
|
+
path: "/sequences/:sequenceId/emails/:emailId/versions",
|
|
2657
|
+
responses: {
|
|
2658
|
+
200: itemsList(sequenceEmailVersionSchema),
|
|
2659
|
+
404: errorSchema
|
|
2660
|
+
},
|
|
2661
|
+
summary: "List the published versions of a broadcast or sequence email",
|
|
2662
|
+
description: "The live version first, then the versions the email was published with before, newest first (at most 20). Restore one with POST /sequences/{sequenceId}/emails/{emailId}/versions/{versionId}/restore."
|
|
2663
|
+
},
|
|
2664
|
+
restoreEmailVersion: {
|
|
2665
|
+
method: "POST",
|
|
2666
|
+
path: "/sequences/:sequenceId/emails/:emailId/versions/:versionId/restore",
|
|
2667
|
+
body: c.noBody(),
|
|
2668
|
+
responses: {
|
|
2669
|
+
200: sequenceSchema,
|
|
2670
|
+
404: errorSchema,
|
|
2671
|
+
409: errorSchema
|
|
2672
|
+
},
|
|
2673
|
+
summary: "Restore an earlier version of a broadcast or sequence email",
|
|
2674
|
+
description: "Loads a published version's subject and content into the email's draft; publish it to roll back. Unless the broadcast or sequence is active, it's restored directly. Restoring the live version discards the draft. A broadcast's title follows the restored subject once it's published. 404 `version_not_found` for a version that isn't one of this email's published versions; 409 `mail_already_sent` for a broadcast that has started sending."
|
|
2293
2675
|
},
|
|
2294
2676
|
sendEmailTest: {
|
|
2295
2677
|
method: "POST",
|
|
@@ -2302,7 +2684,7 @@ var sequencesContract = c.router(
|
|
|
2302
2684
|
429: errorSchema
|
|
2303
2685
|
},
|
|
2304
2686
|
summary: "Send a test of a broadcast or sequence email",
|
|
2305
|
-
description: "Renders the email exactly like a real send (merge tags, footer, tracking) and sends it with a `[Test]` subject prefix through the delivery source the real send would use. Its \"view in browser\" link shows the email as it was when tested, not later edits. Merge tags use the recipient's contact data when they are a contact. Opens, clicks and the unsubscribe link in a test change nothing. Suppressed addresses are skipped. Every recipient counts as one test: by default a team can send 100 test emails in any 24 hours (50 in any 3 hours) and 20 per email per 24 hours, after which this returns 429 `test_send_limit_reached` or `test_send_email_limit_reached`. Tests through an organization's shared mailbox also count against the team's shared-delivery quota (429 `organization_team_quota_exhausted` or `organization_quota_exhausted`)."
|
|
2687
|
+
description: "Renders the email exactly like a real send (merge tags, footer, tracking) and sends it with a `[Test]` subject prefix through the delivery source the real send would use. When the email has unpublished changes, the test sends the draft, so they can be checked before they're published. Its \"view in browser\" link shows the email as it was when tested, not later edits. Merge tags use the recipient's contact data when they are a contact. Opens, clicks and the unsubscribe link in a test change nothing. Suppressed addresses are skipped. Every recipient counts as one test: by default a team can send 100 test emails in any 24 hours (50 in any 3 hours) and 20 per email per 24 hours, after which this returns 429 `test_send_limit_reached` or `test_send_email_limit_reached`. Tests through an organization's shared mailbox also count against the team's shared-delivery quota (429 `organization_team_quota_exhausted` or `organization_quota_exhausted`)."
|
|
2306
2688
|
},
|
|
2307
2689
|
removeEmail: {
|
|
2308
2690
|
method: "DELETE",
|
|
@@ -2312,7 +2694,8 @@ var sequencesContract = c.router(
|
|
|
2312
2694
|
400: errorSchema,
|
|
2313
2695
|
404: errorSchema
|
|
2314
2696
|
},
|
|
2315
|
-
summary: "Remove an email from a sequence"
|
|
2697
|
+
summary: "Remove an email from a sequence",
|
|
2698
|
+
description: "Removes the email. Images it uses that nothing else uses are deleted from the media library and storage; images used by sent mail are kept."
|
|
2316
2699
|
},
|
|
2317
2700
|
start: {
|
|
2318
2701
|
method: "POST",
|
|
@@ -2358,6 +2741,25 @@ var sequencesContract = c.router(
|
|
|
2358
2741
|
responses: { 200: sequenceStatsSchema, 404: errorSchema },
|
|
2359
2742
|
summary: "Delivery / open-rate / click-through-rate stats for a sequence"
|
|
2360
2743
|
},
|
|
2744
|
+
schedule: {
|
|
2745
|
+
method: "GET",
|
|
2746
|
+
path: "/sequences/:sequenceId/schedule",
|
|
2747
|
+
responses: { 200: sequenceScheduleSchema, 404: errorSchema },
|
|
2748
|
+
summary: "Contacts waiting for each email of a sequence",
|
|
2749
|
+
description: "For each email, in send order: how many contacts in the sequence will get it next and the earliest of their due times. A contact counts once, against the email they're waiting for, so emails they've had or will get later don't count them. Each contact's delay counts from their own entry, so their due times differ; list them with `GET /sequences/{sequenceId}/emails/{emailId}/waiting`. Due times are the earliest a contact can get the email; pauses and sending limits can make it later."
|
|
2750
|
+
},
|
|
2751
|
+
waitingContacts: {
|
|
2752
|
+
method: "GET",
|
|
2753
|
+
path: "/sequences/:sequenceId/emails/:emailId/waiting",
|
|
2754
|
+
query: listWaitingContactsQuerySchema,
|
|
2755
|
+
responses: {
|
|
2756
|
+
200: waitingContactsPageSchema,
|
|
2757
|
+
400: errorSchema,
|
|
2758
|
+
404: errorSchema
|
|
2759
|
+
},
|
|
2760
|
+
summary: "Contacts waiting for a sequence email",
|
|
2761
|
+
description: "The contacts whose next email in the sequence is this one, soonest due first, each with their own due time. `q` matches email or name. Pages hold `limit` contacts (default 10, at most 100); pass `nextCursor` as `after` for the next page. `total` counts every match. A cursor that can't be read returns 400 `invalid_cursor`."
|
|
2762
|
+
},
|
|
2361
2763
|
subscribers: {
|
|
2362
2764
|
method: "GET",
|
|
2363
2765
|
path: "/sequences/:sequenceId/subscribers",
|
|
@@ -2520,7 +2922,7 @@ var espCollectionContract = c.router(
|
|
|
2520
2922
|
409: errorSchema
|
|
2521
2923
|
},
|
|
2522
2924
|
summary: "Remove a user-managed ESP configuration",
|
|
2523
|
-
description: "
|
|
2925
|
+
description: "Deletes an ESP that has never carried delivery history; delivery history is never deleted. Draft, paused, and completed sequences are detached first. 409 explains a blocked delete: `esp_is_default` (the team's live default; pick another default or retire it first), `delivery_source_in_use` (a sending sequence or broadcast, or queued email, needs it), or `esp_has_delivery_history` (transactional email, delivery feedback, or grants point at it; retire it instead)."
|
|
2524
2926
|
},
|
|
2525
2927
|
domainAuthentication: {
|
|
2526
2928
|
method: "GET",
|
|
@@ -2915,7 +3317,7 @@ var organizationsContract = c.router(
|
|
|
2915
3317
|
path: "/organizations",
|
|
2916
3318
|
responses: {
|
|
2917
3319
|
200: zod.z.object({
|
|
2918
|
-
items: zod.z.array(
|
|
3320
|
+
items: zod.z.array(organizationListItemSchema),
|
|
2919
3321
|
ownsFreeOrganization: zod.z.boolean()
|
|
2920
3322
|
}),
|
|
2921
3323
|
403: errorSchema
|
|
@@ -2965,7 +3367,8 @@ var organizationsContract = c.router(
|
|
|
2965
3367
|
409: errorSchema,
|
|
2966
3368
|
503: errorSchema
|
|
2967
3369
|
},
|
|
2968
|
-
summary: "
|
|
3370
|
+
summary: "Delete an organization",
|
|
3371
|
+
description: "Owner only, from a dashboard session. Fails with `409 active_subscription_exists` while a subscription is active or paid through a future date (cancel it in billing first), and with `409 billing_checkout_pending` while a checkout is open. Deleting closes the organization, archives its teams, revokes organization and team API keys and sending domains, retires every ESP config with its credentials wiped, and deletes its teams' MediaLit files. Billing history, audit events, delivery reporting and suppressions are kept."
|
|
2969
3372
|
},
|
|
2970
3373
|
abandon: {
|
|
2971
3374
|
method: "POST",
|
|
@@ -3213,7 +3616,8 @@ var organizationsContract = c.router(
|
|
|
3213
3616
|
404: errorSchema,
|
|
3214
3617
|
409: errorSchema
|
|
3215
3618
|
},
|
|
3216
|
-
summary: "Delete an eligible never-activated organization ESP"
|
|
3619
|
+
summary: "Delete an eligible never-activated organization ESP",
|
|
3620
|
+
description: "Only a never-activated draft with no history is deleted. 409 explains a blocked delete: `esp_retire_instead` (it has been activated; retire it instead), `esp_has_delivery_history`, or `delivery_source_in_use`."
|
|
3217
3621
|
},
|
|
3218
3622
|
getEspFeedback: {
|
|
3219
3623
|
method: "GET",
|
|
@@ -3463,6 +3867,13 @@ var overviewContract = c.router(
|
|
|
3463
3867
|
);
|
|
3464
3868
|
var feedbackContract = c.router(
|
|
3465
3869
|
{
|
|
3870
|
+
requirement: {
|
|
3871
|
+
method: "GET",
|
|
3872
|
+
path: "/settings/feedback-requirement",
|
|
3873
|
+
responses: { 200: feedbackRequirementSchema },
|
|
3874
|
+
summary: "Get when ESPs need a delivery-feedback connection",
|
|
3875
|
+
description: "On SendLit Cloud, once the organization has sent `requiredAfterSends` emails, SendLit only sends through ESPs with a healthy bounce/complaint feedback connection. `required` is false on self-hosted SendLit."
|
|
3876
|
+
},
|
|
3466
3877
|
get: {
|
|
3467
3878
|
method: "GET",
|
|
3468
3879
|
path: "/settings/esps/:espId/feedback",
|
|
@@ -3767,9 +4178,51 @@ var billingContract = c.router(
|
|
|
3767
4178
|
},
|
|
3768
4179
|
{ metadata: { tag: "Billing" } }
|
|
3769
4180
|
);
|
|
4181
|
+
var accountContract = c.router({
|
|
4182
|
+
getDeletion: {
|
|
4183
|
+
method: "GET",
|
|
4184
|
+
path: "/account/deletion",
|
|
4185
|
+
responses: {
|
|
4186
|
+
200: accountDeletionPreviewSchema,
|
|
4187
|
+
401: errorSchema,
|
|
4188
|
+
403: errorSchema
|
|
4189
|
+
},
|
|
4190
|
+
summary: "Preview deleting your account",
|
|
4191
|
+
description: "Dashboard session only. Lists every organization you belong to and what deleting your account does to it: `delete` when you are its last owner (it is deleted and its contacts' personal data erased), `leave` otherwise. `blocker` says what has to happen first: `active_subscription_exists` or `billing_checkout_pending` (cancel billing), `last_organization_owner` (other people are members: make one of them an owner or remove them), `billing_manager_required` (you pay for a running subscription of an organization you would leave)."
|
|
4192
|
+
},
|
|
4193
|
+
sendDeletionCode: {
|
|
4194
|
+
method: "POST",
|
|
4195
|
+
path: "/account/deletion/code",
|
|
4196
|
+
body: c.noBody(),
|
|
4197
|
+
responses: {
|
|
4198
|
+
204: c.noBody(),
|
|
4199
|
+
401: errorSchema,
|
|
4200
|
+
403: errorSchema,
|
|
4201
|
+
429: errorSchema
|
|
4202
|
+
},
|
|
4203
|
+
summary: "Email a code to confirm deleting your account",
|
|
4204
|
+
description: "Dashboard session only. Sends a one-time code, valid for 5 minutes, to the account's email. `POST /account/deletion` needs it."
|
|
4205
|
+
},
|
|
4206
|
+
delete: {
|
|
4207
|
+
method: "POST",
|
|
4208
|
+
path: "/account/deletion",
|
|
4209
|
+
body: deleteAccountBodySchema,
|
|
4210
|
+
responses: {
|
|
4211
|
+
204: c.noBody(),
|
|
4212
|
+
400: errorSchema,
|
|
4213
|
+
401: errorSchema,
|
|
4214
|
+
403: errorSchema,
|
|
4215
|
+
409: accountDeletionBlockedSchema
|
|
4216
|
+
},
|
|
4217
|
+
summary: "Delete your account",
|
|
4218
|
+
description: "Dashboard session only, with the account's email typed to confirm and the code from `POST /account/deletion/code` (`400 email_mismatch`, `400 invalid_code`). Fails with `409 account_deletion_blocked`, listing the blocking organizations, while any blocker from `GET /account/deletion` remains; nothing changes then. Otherwise every organization you are the last owner of is deleted like `DELETE /organizations/:organizationId` and its contacts, signup confirmations, recipient addresses and raw webhook payloads are erased (suppression hashes stay); you leave every other organization and team; your sessions, sign-in methods, OAuth tokens and consents end; and your name and email are erased. Billing records and audit events keep an anonymous id. Signing in again with the same email creates a new, empty account."
|
|
4219
|
+
}
|
|
4220
|
+
});
|
|
3770
4221
|
var contract = c.router({
|
|
4222
|
+
account: accountContract,
|
|
3771
4223
|
contacts: contactsContract,
|
|
3772
4224
|
segments: segmentsContract,
|
|
4225
|
+
tags: tagsContract,
|
|
3773
4226
|
media: mediaContract,
|
|
3774
4227
|
templates: templatesContract,
|
|
3775
4228
|
sequences: sequencesContract,
|
|
@@ -4131,6 +4584,43 @@ var Sequences = class {
|
|
|
4131
4584
|
body: input
|
|
4132
4585
|
});
|
|
4133
4586
|
}
|
|
4587
|
+
/** Publishes unpublished email changes (drafts) of a broadcast or
|
|
4588
|
+
* sequence, so sends use them. While it's active, `updateEmail` saves
|
|
4589
|
+
* subject and content changes as a draft. */
|
|
4590
|
+
async publishChanges(sequenceId, input = {}) {
|
|
4591
|
+
return this.http.request(routes7.publishChanges, {
|
|
4592
|
+
params: { sequenceId: assertId(sequenceId, "sequenceId") },
|
|
4593
|
+
body: input
|
|
4594
|
+
});
|
|
4595
|
+
}
|
|
4596
|
+
/** Throws away unpublished email changes. Sends are not affected. */
|
|
4597
|
+
async discardChanges(sequenceId, input = {}) {
|
|
4598
|
+
return this.http.request(routes7.discardChanges, {
|
|
4599
|
+
params: { sequenceId: assertId(sequenceId, "sequenceId") },
|
|
4600
|
+
body: input
|
|
4601
|
+
});
|
|
4602
|
+
}
|
|
4603
|
+
/** The versions an email has been published with, live one first. */
|
|
4604
|
+
async emailVersions(sequenceId, emailId) {
|
|
4605
|
+
const { items } = await this.http.request(routes7.emailVersions, {
|
|
4606
|
+
params: {
|
|
4607
|
+
sequenceId: assertId(sequenceId, "sequenceId"),
|
|
4608
|
+
emailId: assertId(emailId, "emailId")
|
|
4609
|
+
}
|
|
4610
|
+
});
|
|
4611
|
+
return items;
|
|
4612
|
+
}
|
|
4613
|
+
/** Loads an earlier published version into the email's draft; publish
|
|
4614
|
+
* it with `publishChanges` to roll back. */
|
|
4615
|
+
async restoreEmailVersion(sequenceId, emailId, versionId) {
|
|
4616
|
+
return this.http.request(routes7.restoreEmailVersion, {
|
|
4617
|
+
params: {
|
|
4618
|
+
sequenceId: assertId(sequenceId, "sequenceId"),
|
|
4619
|
+
emailId: assertId(emailId, "emailId"),
|
|
4620
|
+
versionId: assertId(versionId, "versionId")
|
|
4621
|
+
}
|
|
4622
|
+
});
|
|
4623
|
+
}
|
|
4134
4624
|
async removeEmail(sequenceId, emailId) {
|
|
4135
4625
|
return this.http.request(routes7.removeEmail, {
|
|
4136
4626
|
params: {
|