@proveanything/smartlinks 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3230 @@
1
+ # Smartlinks API Summary
2
+
3
+ Version: 1.3.1 | Generated: 2026-01-30T18:16:59.130Z
4
+
5
+ This is a concise summary of all available API functions and types.
6
+
7
+ ## API Namespaces
8
+
9
+ The Smartlinks SDK is organized into the following namespaces:
10
+
11
+ — Core Data & Configuration —
12
+ - **collection** - Manage collections, settings, and identifiers for your workspace.
13
+ - **product** - Create and manage products within a collection; metadata, tags, media.
14
+ - **variant** - Manage product variants per product; includes serial number helpers.
15
+ - **asset** - Upload and manage media assets for collections, products, and proofs.
16
+ - **batch** - Group products into batches; manage serial number ranges and lookups.
17
+ - **crate** - Organize products in containers/crates for logistics and grouping.
18
+ - **form** - Build and manage dynamic forms used by apps and workflows.
19
+ - **appRecord** - Store and retrieve application-level records tied to a collection.
20
+ - **appConfiguration** - Read/write app configuration and scoped data (collection/product/proof).
21
+
22
+ — Identity & Access —
23
+ - **auth** - Admin authentication and account ops: login/logout, tokens, account info.
24
+ - **authKit** - End‑user auth flows (email/password, OAuth, phone); profiles and verification.
25
+ - **contact** - Manage customer contacts; CRUD, lookup, upsert, erase.
26
+
27
+ — Messaging & Audience —
28
+ - **comms** - Send notifications (push, email, wallet); templating, severity, delivery status.
29
+ - **broadcasts** - Define broadcast campaigns; append recipients/events; analytics and CRUD.
30
+ - **segments** - Define dynamic/static audience segments; estimate and list recipients; schedule calculations.
31
+
32
+ — Analytics & Events —
33
+ - **interactions** - Log and analyze interactions/outcomes; aggregates and actor lists; interaction definition CRUD.
34
+
35
+ — Automation —
36
+ - **journeys** - Configure automated flows triggered by events or schedules; steps, rules; full CRUD.
37
+
38
+ — NFC, Proofs & Claims —
39
+ - **nfc** - Claim and validate NFC tags; perform tag lookups.
40
+ - **proof** - Create, update, claim, and list product proofs (digital certificates).
41
+ - **claimSet** - Manage claim sets and tag assignments; queries, reports, and updates.
42
+ - **qr** - Lookup short codes to resolve collection/product/proof context.
43
+
44
+ — AI & Utilities —
45
+ - **ai** - Generate content and images, search photos, chat, upload files, and cache.
46
+ - **serialNumber** - Assign, lookup, and manage serial numbers across scopes.
47
+
48
+ — Other —
49
+ - **async** - Functions for async operations
50
+ - **attestation** - Functions for attestation operations
51
+ - **jobs** - Functions for jobs operations
52
+ - **journeysAnalytics** - Functions for journeysAnalytics operations
53
+ - **location** - Functions for location operations
54
+ - **realtime** - Functions for realtime operations
55
+ - **template** - Functions for template operations
56
+
57
+ ## HTTP Utilities
58
+
59
+ Core HTTP functions for API configuration and communication:
60
+
61
+ **isProxyEnabled**() → `boolean`
62
+ Return whether proxy mode is currently enabled.
63
+
64
+ **initializeApi**(options: {
65
+ baseURL: string
66
+ apiKey?: string
67
+ bearerToken?: string
68
+ proxyMode?: boolean
69
+ ngrokSkipBrowserWarning?: boolean
70
+ extraHeaders?: Record<string, string>
71
+ iframeAutoResize?: boolean // default true when in iframe
72
+ logger?: Logger // optional console-like or function to enable verbose logging
73
+ }) → `void`
74
+ Call this once (e.g. at app startup) to configure baseURL/auth.
75
+
76
+ **setNgrokSkipBrowserWarning**(flag: boolean) → `void`
77
+ Enable/disable automatic "ngrok-skip-browser-warning" header.
78
+
79
+ **setExtraHeaders**(headers: Record<string, string>) → `void`
80
+ Replace or augment globally applied custom headers.
81
+
82
+ **setBearerToken**(token: string | undefined) → `void`
83
+ Allows setting the bearerToken at runtime (e.g. after login/logout).
84
+
85
+ **proxyUploadFormData**(path: string,
86
+ formData: FormData,
87
+ onProgress?: (percent: number) → `void`
88
+ Upload a FormData payload via proxy with progress events using chunked postMessage. Parent is expected to implement the counterpart protocol.
89
+
90
+ **request**(path: string) → `Promise<T>`
91
+ Internal helper that performs a GET request to \`\${baseURL}\${path}\`, injecting headers for apiKey or bearerToken if present. Returns the parsed JSON as T, or throws an Error.
92
+
93
+ **post**(path: string,
94
+ body: any,
95
+ extraHeaders?: Record<string, string>) → `Promise<T>`
96
+ Internal helper that performs a POST request to `${baseURL}${path}`, injecting headers for apiKey or bearerToken if present. If body is FormData, Content-Type is not set. Returns the parsed JSON as T, or throws an Error.
97
+
98
+ **put**(path: string,
99
+ body: any,
100
+ extraHeaders?: Record<string, string>) → `Promise<T>`
101
+ Internal helper that performs a PUT request to `${baseURL}${path}`, injecting headers for apiKey or bearerToken if present. If body is FormData, Content-Type is not set. Returns the parsed JSON as T, or throws an Error.
102
+
103
+ **patch**(path: string,
104
+ body: any,
105
+ extraHeaders?: Record<string, string>) → `Promise<T>`
106
+ Internal helper that performs a PATCH request to `${baseURL}${path}`, injecting headers for apiKey or bearerToken if present. If body is FormData, Content-Type is not set. Returns the parsed JSON as T, or throws an Error.
107
+
108
+ **requestWithOptions**(path: string,
109
+ options: RequestInit) → `Promise<T>`
110
+ Internal helper that performs a request to `${baseURL}${path}` with custom options, injecting headers for apiKey or bearerToken if present. Returns the parsed JSON as T, or throws an Error.
111
+
112
+ **del**(path: string,
113
+ extraHeaders?: Record<string, string>) → `Promise<T>`
114
+ Internal helper that performs a DELETE request to `${baseURL}${path}`, injecting headers for apiKey or bearerToken if present. Returns the parsed JSON as T, or throws an Error.
115
+
116
+ **getApiHeaders**() → `Record<string, string>`
117
+ Returns the common headers used for API requests, including apiKey and bearerToken if set.
118
+
119
+ **sendCustomProxyMessage**(request: string, params: any) → `Promise<T>`
120
+ Sends a custom proxy message to the parent Smartlinks application when running in an iframe. This function is used to communicate with the parent window when the SDK is embedded in an iframe and proxyMode is enabled. It sends a message to the parent and waits for a response.
121
+
122
+ ## Error Handling
123
+
124
+ All API functions throw `SmartlinksApiError` when requests fail. This error class provides structured access to HTTP status codes, server error codes, and additional context.
125
+
126
+ ### SmartlinksApiError
127
+
128
+ **Properties:**
129
+ - **message** `string` - Human-readable error message in English (e.g., "Error 400: Not Authorized")
130
+ - **statusCode** `number` - HTTP status code (400, 401, 404, 500, etc.)
131
+ - **code** `number` - Numeric error code (same as statusCode)
132
+ - **details** `Record<string, any> | undefined` - Additional server response data, including string error codes
133
+ - **url** `string | undefined` - The URL that was requested
134
+
135
+ **Helper Methods:**
136
+ - **isAuthError()** `boolean` - Returns true for 401 or 403 status codes
137
+ - **isNotFound()** `boolean` - Returns true for 404 status code
138
+ - **isRateLimited()** `boolean` - Returns true for 429 status code
139
+ - **isClientError()** `boolean` - Returns true for 4xx status codes
140
+ - **isServerError()** `boolean` - Returns true for 5xx status codes
141
+ - **toJSON()** `object` - Returns a serializable object for logging
142
+
143
+ ### Error Format Normalization
144
+
145
+ The SDK automatically normalizes various server error response formats into a consistent structure. The server may return errors in different formats, but they are all accessible through the same properties.
146
+
147
+ **Server String Error Codes:**
148
+ Server-specific error identifiers are preserved in `error.details`:
149
+ - Access via: `error.details?.errorCode` or `error.details?.error`
150
+ - Format examples: `"NOT_AUTHORIZED"`, `"broadcasts.topic.invalid"`, `"sendgrid.provision.failed"`
151
+ - Use these for programmatic error handling (switch statements, conditional logic)
152
+
153
+ ### Usage Examples
154
+
155
+ **Basic Error Handling:**
156
+ ```typescript
157
+ import { SmartlinksApiError, product } from '@proveanything/smartlinks'
158
+
159
+ try {
160
+ const item = await product.get('collectionId', 'productId')
161
+ } catch (error) {
162
+ if (error instanceof SmartlinksApiError) {
163
+ console.error('Status:', error.statusCode) // 404
164
+ console.error('Message:', error.message) // "Error 404: Not found"
165
+ console.error('URL:', error.url) // "/public/collection/..."
166
+ }
167
+ }
168
+ ```
169
+
170
+ **Using Helper Methods:**
171
+ ```typescript
172
+ try {
173
+ await product.create('collectionId', data)
174
+ } catch (error) {
175
+ if (error instanceof SmartlinksApiError) {
176
+ if (error.isAuthError()) {
177
+ // Handle 401/403 - redirect to login
178
+ redirectToLogin()
179
+ } else if (error.isNotFound()) {
180
+ // Handle 404
181
+ showNotFound()
182
+ } else if (error.isRateLimited()) {
183
+ // Handle 429 - implement retry with backoff
184
+ await retryAfterDelay()
185
+ } else if (error.isServerError()) {
186
+ // Handle 5xx
187
+ showMaintenanceMessage()
188
+ }
189
+ }
190
+ }
191
+ ```
192
+
193
+ **Accessing Server Error Codes:**
194
+ ```typescript
195
+ try {
196
+ await broadcasts.send('collectionId', 'broadcastId', options)
197
+ } catch (error) {
198
+ if (error instanceof SmartlinksApiError) {
199
+ // Extract server-defined string error code
200
+ const serverCode = error.details?.errorCode || error.details?.error
201
+
202
+ switch (serverCode) {
203
+ case 'NOT_AUTHORIZED':
204
+ redirectToLogin()
205
+ break
206
+ case 'broadcasts.topic.invalid':
207
+ showTopicSelector()
208
+ break
209
+ case 'sendgrid.provision.failed':
210
+ alertAdmin('Email service error')
211
+ break
212
+ default:
213
+ showError(error.message)
214
+ }
215
+ }
216
+ }
217
+ ```
218
+
219
+ **Error Logging for Monitoring:**
220
+ ```typescript
221
+ try {
222
+ await api.someMethod()
223
+ } catch (error) {
224
+ if (error instanceof SmartlinksApiError) {
225
+ // Log structured error data
226
+ logger.error('API Error', error.toJSON())
227
+
228
+ // Send to monitoring service
229
+ Sentry.captureException(error, {
230
+ extra: error.toJSON(),
231
+ tags: {
232
+ statusCode: error.statusCode,
233
+ serverErrorCode: error.details?.errorCode || error.details?.error,
234
+ }
235
+ })
236
+ }
237
+ }
238
+ ```
239
+
240
+ **Handling Validation Errors:**
241
+ ```typescript
242
+ try {
243
+ await product.create('collectionId', formData)
244
+ } catch (error) {
245
+ if (error instanceof SmartlinksApiError && error.statusCode === 400) {
246
+ // Access field-specific validation errors if available
247
+ if (error.details?.fields) {
248
+ Object.entries(error.details.fields).forEach(([field, message]) => {
249
+ showFieldError(field, String(message))
250
+ })
251
+ } else {
252
+ showError(error.message)
253
+ }
254
+ }
255
+ }
256
+ ```
257
+
258
+ **Retry Logic for Transient Errors:**
259
+ ```typescript
260
+ async function withRetry<T>(fn: () => Promise<T>, maxRetries = 3): Promise<T> {
261
+ for (let attempt = 0; attempt < maxRetries; attempt++) {
262
+ try {
263
+ return await fn()
264
+ } catch (error) {
265
+ if (error instanceof SmartlinksApiError) {
266
+ // Only retry server errors and rate limiting
267
+ const shouldRetry = error.isServerError() || error.isRateLimited()
268
+
269
+ if (!shouldRetry || attempt === maxRetries - 1) {
270
+ throw error
271
+ }
272
+
273
+ // Exponential backoff
274
+ const delay = 1000 * Math.pow(2, attempt)
275
+ await new Promise(resolve => setTimeout(resolve, delay))
276
+ } else {
277
+ throw error
278
+ }
279
+ }
280
+ }
281
+ throw new Error('Max retries exceeded')
282
+ }
283
+
284
+ // Usage
285
+ const collections = await withRetry(() => collection.list())
286
+ ```
287
+
288
+ ### Error Code Reference
289
+
290
+ **HTTP Status Codes (numeric):**
291
+ - `400` - Bad Request (invalid input)
292
+ - `401` - Unauthorized (authentication required)
293
+ - `403` - Forbidden (insufficient permissions)
294
+ - `404` - Not Found (resource doesn't exist)
295
+ - `429` - Too Many Requests (rate limited)
296
+ - `500` - Internal Server Error
297
+ - `502` - Bad Gateway
298
+ - `503` - Service Unavailable
299
+
300
+ **Server Error Codes (strings in `details.errorCode` or `details.error`):**
301
+ Examples include:
302
+ - `"NOT_AUTHORIZED"` - Not authorized for this action
303
+ - `"broadcasts.topic.invalid"` - Invalid communication topic
304
+ - `"broadcasts.manual.segment.missing"` - Missing required segment
305
+ - `"sendgrid.provision.failed"` - Email service provisioning failed
306
+ - `"validation.failed"` - Request validation failed
307
+
308
+ *Note: Server error codes use either `UPPERCASE_UNDERSCORE` or `dotted.notation` format. Both are supported.*
309
+
310
+ ## Types
311
+
312
+ ### appConfiguration
313
+
314
+ **AppConfigurationResponse** (interface)
315
+ ```typescript
316
+ interface AppConfigurationResponse {
317
+ id: string
318
+ name: string
319
+ settings?: Record<string, any>
320
+ }
321
+ ```
322
+
323
+ ### asset
324
+
325
+ **Asset** (interface)
326
+ ```typescript
327
+ interface Asset {
328
+ id: string
329
+ url: string
330
+ name: string
331
+ mimeType?: string
332
+ size?: number
333
+ createdAt?: string
334
+ metadata?: Record<string, any>
335
+ assetType?: string
336
+ type?: string
337
+ collectionId?: string
338
+ hash?: string
339
+ thumbnails?: {
340
+ x100?: string
341
+ x200?: string
342
+ x512?: string
343
+ [key: string]: string | undefined
344
+ }
345
+ site?: string
346
+ cleanName?: string
347
+ }
348
+ ```
349
+
350
+ **UploadAssetOptions** (interface)
351
+ ```typescript
352
+ interface UploadAssetOptions {
353
+ file: File
354
+ scope:
355
+ | { type: 'collection'; collectionId: string }
356
+ | { type: 'product'; collectionId: string; productId: string }
357
+ | { type: 'proof'; collectionId: string; productId: string; proofId: string }
358
+ name?: string
359
+ metadata?: Record<string, any>
360
+ onProgress?: (percent: number) => void
361
+ appId?: string
362
+ admin?: boolean
363
+ }
364
+ ```
365
+
366
+ **ListAssetsOptions** (interface)
367
+ ```typescript
368
+ interface ListAssetsOptions {
369
+ scope:
370
+ | { type: 'collection'; collectionId: string }
371
+ | { type: 'product'; collectionId: string; productId: string }
372
+ | { type: 'proof'; collectionId: string; productId: string; proofId: string }
373
+ appId?: string
374
+ mimeTypePrefix?: string
375
+ limit?: number
376
+ offset?: number
377
+ }
378
+ ```
379
+
380
+ **GetAssetOptions** (interface)
381
+ ```typescript
382
+ interface GetAssetOptions {
383
+ assetId: string
384
+ scope:
385
+ | { type: 'collection'; collectionId: string }
386
+ | { type: 'product'; collectionId: string; productId: string }
387
+ | { type: 'proof'; collectionId: string; productId: string; proofId: string }
388
+ }
389
+ ```
390
+
391
+ **RemoveAssetOptions** (interface)
392
+ ```typescript
393
+ interface RemoveAssetOptions {
394
+ assetId: string
395
+ scope:
396
+ | { type: 'collection'; collectionId: string }
397
+ | { type: 'product'; collectionId: string; productId: string }
398
+ | { type: 'proof'; collectionId: string; productId: string; proofId: string }
399
+ }
400
+ ```
401
+
402
+ **AssetResponse** = `Asset`
403
+
404
+ ### attestation
405
+
406
+ **AttestationResponse** (interface)
407
+ ```typescript
408
+ interface AttestationResponse {
409
+ id: string
410
+ createdAt: string
411
+ updatedAt: string
412
+ public: Record<string, any>
413
+ private: Record<string, any>
414
+ proof: Record<string, any>
415
+ }
416
+ ```
417
+
418
+ **AttestationCreateRequest** (interface)
419
+ ```typescript
420
+ interface AttestationCreateRequest {
421
+ public: Record<string, any>
422
+ private: Record<string, any>
423
+ proof: Record<string, any>
424
+ }
425
+ ```
426
+
427
+ **AttestationUpdateRequest** (interface)
428
+ ```typescript
429
+ interface AttestationUpdateRequest {
430
+ type?: string
431
+ data?: Record<string, any>
432
+ }
433
+ ```
434
+
435
+ ### auth
436
+
437
+ **UserAccountRegistrationRequest** (interface)
438
+ ```typescript
439
+ interface UserAccountRegistrationRequest {
440
+ name: string
441
+ email?: string
442
+ phone?: string
443
+ password?: string
444
+ sendAccountConfirmation?: boolean
445
+ collectionId?: string,
446
+ tokenType?: 'bearer' | 'firebase'
447
+ }
448
+ ```
449
+
450
+ ### authKit
451
+
452
+ **AuthKitUser** (interface)
453
+ ```typescript
454
+ interface AuthKitUser {
455
+ uid: string
456
+ email?: string
457
+ displayName?: string | null
458
+ photoURL?: string | null
459
+ phoneNumber?: string | null
460
+ emailVerified?: boolean
461
+ accountData?: Record<string, any>
462
+ }
463
+ ```
464
+
465
+ **UserProfile** (interface)
466
+ ```typescript
467
+ interface UserProfile {
468
+ uid: string
469
+ email?: string
470
+ displayName?: string | null
471
+ phoneNumber?: string | null
472
+ photoURL?: string | null
473
+ emailVerified?: boolean
474
+ accountData?: Record<string, any>
475
+ }
476
+ ```
477
+
478
+ **ProfileUpdateData** (interface)
479
+ ```typescript
480
+ interface ProfileUpdateData {
481
+ displayName?: string
482
+ photoURL?: string
483
+ accountData?: Record<string, any>
484
+ }
485
+ ```
486
+
487
+ **SuccessResponse** (interface)
488
+ ```typescript
489
+ interface SuccessResponse {
490
+ success: boolean
491
+ message?: string
492
+ token?: string // some flows may return a refreshed token
493
+ }
494
+ ```
495
+
496
+ **AuthLoginResponse** (interface)
497
+ ```typescript
498
+ interface AuthLoginResponse {
499
+ token?: string
500
+ user: AuthKitUser
501
+ accountData?: Record<string, any>
502
+ emailVerificationMode?: 'immediate' | 'verify-auto-login' | 'verify-manual-login'
503
+ requiresEmailVerification?: boolean // True if email verification is required but not yet completed
504
+ emailVerificationDeadline?: number // Unix timestamp - for 'immediate' mode grace period deadline
505
+ accountLocked?: boolean // True if account is locked due to expired verification deadline
506
+ }
507
+ ```
508
+
509
+ **MagicLinkSendResponse** (interface)
510
+ ```typescript
511
+ interface MagicLinkSendResponse {
512
+ success: boolean
513
+ message: string
514
+ }
515
+ ```
516
+
517
+ **PhoneSendCodeResponse** (interface)
518
+ ```typescript
519
+ interface PhoneSendCodeResponse {
520
+ verificationId: string
521
+ message: string
522
+ }
523
+ ```
524
+
525
+ **PhoneVerifyResponse** (interface)
526
+ ```typescript
527
+ interface PhoneVerifyResponse {
528
+ token: string
529
+ user: AuthKitUser
530
+ }
531
+ ```
532
+
533
+ **PasswordResetRequestResponse** (interface)
534
+ ```typescript
535
+ interface PasswordResetRequestResponse {
536
+ success: boolean
537
+ message: string
538
+ }
539
+ ```
540
+
541
+ **VerifyResetTokenResponse** (interface)
542
+ ```typescript
543
+ interface VerifyResetTokenResponse {
544
+ valid: boolean
545
+ email?: string
546
+ expiresAt?: number
547
+ message?: string
548
+ }
549
+ ```
550
+
551
+ **PasswordResetCompleteResponse** (interface)
552
+ ```typescript
553
+ interface PasswordResetCompleteResponse {
554
+ success: boolean
555
+ message: string
556
+ }
557
+ ```
558
+
559
+ **EmailVerificationActionResponse** (interface)
560
+ ```typescript
561
+ interface EmailVerificationActionResponse {
562
+ success: boolean
563
+ message: string
564
+ }
565
+ ```
566
+
567
+ **EmailVerifyTokenResponse** (interface)
568
+ ```typescript
569
+ interface EmailVerifyTokenResponse {
570
+ success: boolean
571
+ message: string
572
+ token?: string
573
+ user?: AuthKitUser
574
+ accountData?: Record<string, any>
575
+ emailVerificationMode?: 'immediate' | 'verify-auto-login' | 'verify-manual-login'
576
+ }
577
+ ```
578
+
579
+ **AuthKitBrandingConfig** (interface)
580
+ ```typescript
581
+ interface AuthKitBrandingConfig {
582
+ logoUrl?: string
583
+ title?: string
584
+ subtitle?: string
585
+ primaryColor?: string
586
+ secondaryColor?: string
587
+ backgroundColor?: string
588
+ buttonStyle?: string
589
+ fontFamily?: string
590
+ }
591
+ ```
592
+
593
+ **AuthKitConfig** (interface)
594
+ ```typescript
595
+ interface AuthKitConfig {
596
+ id: string
597
+ branding?: AuthKitBrandingConfig
598
+ enabledProviders?: string[]
599
+ customCss?: string
600
+ termsUrl?: string
601
+ privacyUrl?: string
602
+ supportEmail?: string
603
+ redirectUrl?: string
604
+ updatedAt?: string
605
+ }
606
+ ```
607
+
608
+ ### batch
609
+
610
+ **BatchResponse** = `any`
611
+
612
+ **BatchCreateRequest** = `any`
613
+
614
+ **BatchUpdateRequest** = `any`
615
+
616
+ ### broadcasts
617
+
618
+ **ListBroadcastsQuery** (interface)
619
+ ```typescript
620
+ interface ListBroadcastsQuery {
621
+ limit?: number
622
+ offset?: number
623
+ appId?: string
624
+ }
625
+ ```
626
+
627
+ **BroadcastRecord** (interface)
628
+ ```typescript
629
+ interface BroadcastRecord {
630
+ id: string
631
+ collectionId: string
632
+ appId: string
633
+ templateId?: string | null
634
+ segmentId?: string | null
635
+ status?: string | null
636
+ scheduledAt?: string | null
637
+ sentAt?: string | null
638
+ data?: {
639
+ display?: {
640
+ title?: string
641
+ description?: string
642
+ icon?: string
643
+ color?: string
644
+ }
645
+ broadcastType?: string
646
+ topic: string
647
+ templateParams?: Record<string, unknown>;
648
+ channelSettings?: {
649
+ mode?: 'preferred' | 'channels' | 'all'
650
+ channels?: Array<{
651
+ channel: BroadcastChannel
652
+ enabled?: boolean
653
+ priority?: number
654
+ }>
655
+ }
656
+ [key: string]: unknown
657
+ }
658
+ createdAt: string
659
+ }
660
+ ```
661
+
662
+ **BroadcastList** (interface)
663
+ ```typescript
664
+ interface BroadcastList {
665
+ items: BroadcastRecord[]
666
+ limit: number
667
+ offset: number
668
+ }
669
+ ```
670
+
671
+ **BroadcastRecipientsResponse** (interface)
672
+ ```typescript
673
+ interface BroadcastRecipientsResponse {
674
+ items: import('./comms').Recipient[]
675
+ total: number
676
+ limit: number
677
+ offset: number
678
+ note?: string
679
+ }
680
+ ```
681
+
682
+ **BroadcastPreviewRequest** (interface)
683
+ ```typescript
684
+ interface BroadcastPreviewRequest {
685
+ contactId?: string
686
+ email?: string
687
+ phone?: string
688
+ props?: Record<string, any>
689
+ channelOverride?: BroadcastChannel
690
+ hydrate?: boolean
691
+ include?: { product?: boolean; proof?: boolean; user?: boolean; [k: string]: boolean | undefined }
692
+ }
693
+ ```
694
+
695
+ **BroadcastSendTestRequest** (interface)
696
+ ```typescript
697
+ interface BroadcastSendTestRequest {
698
+ contactId?: string
699
+ email?: string
700
+ phone?: string
701
+ props?: Record<string, any>
702
+ channelOverride?: BroadcastChannel
703
+ hydrate?: boolean
704
+ include?: { product?: boolean; proof?: boolean; user?: boolean; [k: string]: boolean | undefined }
705
+ }
706
+ ```
707
+
708
+ **BroadcastSendTestResponse** (interface)
709
+ ```typescript
710
+ interface BroadcastSendTestResponse {
711
+ ok: boolean; id?: string; channel?: BroadcastChannel
712
+ }
713
+ ```
714
+
715
+ **BroadcastSendManualRequest** (interface)
716
+ ```typescript
717
+ interface BroadcastSendManualRequest {
718
+ limit?: number
719
+ offset?: number
720
+ dryRun?: boolean
721
+ sharedContext?: Record<string, any>
722
+ }
723
+ ```
724
+
725
+ **BroadcastSendManualResponse** (interface)
726
+ ```typescript
727
+ interface BroadcastSendManualResponse {
728
+ ok: boolean
729
+ counts: { sent: number; failed: number; skipped: number }
730
+ page: { limit: number; offset: number; total: number }
731
+ results: Array<{
732
+ contactId: string
733
+ status: 'sent' | 'failed' | 'skipped' | 'dry_run'
734
+ id?: string
735
+ error?: string
736
+ message?: string
737
+ }>
738
+ }
739
+ ```
740
+
741
+ **BroadcastSendRequest** (interface)
742
+ ```typescript
743
+ interface BroadcastSendRequest {
744
+ pageSize?: number
745
+ maxPages?: number
746
+ sharedContext?: Record<string, any>
747
+ channel?: BroadcastChannel
748
+ hydrate?: boolean
749
+ include?: { product?: boolean; proof?: boolean; user?: boolean; [k: string]: boolean | undefined }
750
+ }
751
+ ```
752
+
753
+ **BroadcastAppendEventBody** (interface)
754
+ ```typescript
755
+ interface BroadcastAppendEventBody {
756
+ broadcastId: string
757
+ contactId?: string
758
+ channel?: BroadcastChannel
759
+ templateId?: string
760
+ eventType: string
761
+ outcome?: 'success' | 'failed'
762
+ failureReason?: string
763
+ metadata?: Record<string, any>
764
+ }
765
+ ```
766
+
767
+ **BroadcastAppendBulkBody** (interface)
768
+ ```typescript
769
+ interface BroadcastAppendBulkBody {
770
+ ids: string[]
771
+ idField?: string
772
+ params: Record<string, any> // merged with collectionId server-side
773
+ }
774
+ ```
775
+
776
+ **BroadcastChannel** = `'email' | 'push' | 'sms' | 'wallet'`
777
+
778
+ **BroadcastPreviewResponse** = ``
779
+
780
+ ### claimSet
781
+
782
+ **ClaimCodeRef** (interface)
783
+ ```typescript
784
+ interface ClaimCodeRef {
785
+ codeId: string
786
+ claimId: string
787
+ }
788
+ ```
789
+
790
+ **UpdateClaimDataRequest** (interface)
791
+ ```typescript
792
+ interface UpdateClaimDataRequest {
793
+ data: Record<string, any>
794
+ codes: ClaimCodeRef[]
795
+ }
796
+ ```
797
+
798
+ **AssignClaimsRequest** (interface)
799
+ ```typescript
800
+ interface AssignClaimsRequest {
801
+ id: string
802
+ collectionId: string
803
+ productId: string
804
+ batchId?: string
805
+ start?: number
806
+ end?: number
807
+ codeId?: string
808
+ data?: Record<string, any>
809
+ }
810
+ ```
811
+
812
+ ### collection
813
+
814
+ **Collection** (interface)
815
+ ```typescript
816
+ interface Collection {
817
+ id: string
818
+ title: string
819
+ description: string
820
+ headerImage?: {
821
+ url: string
822
+ thumbnails: {
823
+ x100: string
824
+ x200: string
825
+ x512: string
826
+ }
827
+ }
828
+ logoImage?: {
829
+ url: string
830
+ thumbnails: {
831
+ x100: string
832
+ x200: string
833
+ x512: string
834
+ }
835
+ }
836
+ loaderImage?: {
837
+ overwriteName: string
838
+ name: string
839
+ type: string
840
+ url: string
841
+ }
842
+ languages?: {
843
+ code: string
844
+ lang: string
845
+ supported: boolean
846
+ }[],
847
+ roles: {
848
+ [userId: string]: string
849
+ } // User roles mapping with user IDs as keys and role names as values
850
+ groupTags?: string[] // Array of group tag names
851
+ redirectUrl?: string // Whether the collection has a custom domain
852
+ shortId: string, // The shortId of this collection
853
+ dark?: boolean // if dark mode is enabled for this collection
854
+ }
855
+ ```
856
+
857
+ **CollectionResponse** = `Collection`
858
+
859
+ **CollectionCreateRequest** = `Omit<Collection, 'id' | 'shortId'>`
860
+
861
+ **CollectionUpdateRequest** = `Partial<Omit<Collection, 'id' | 'shortId'>>`
862
+
863
+ ### common
864
+
865
+ **IdField** = `'userId' | 'contactId'`
866
+
867
+ ### comms
868
+
869
+ **NotificationSubjectTarget** (interface)
870
+ ```typescript
871
+ interface NotificationSubjectTarget {
872
+ type: 'product' | 'collection' | 'user' | 'batch' | 'proof'
873
+ id: string
874
+ }
875
+ ```
876
+
877
+ **CommunicationEvent** (interface)
878
+ ```typescript
879
+ interface CommunicationEvent {
880
+ orgId: string
881
+ broadcastId?: string
882
+ journeyId?: string
883
+ userId?: string
884
+ contactId?: string
885
+ channel?: string
886
+ timestamp: string
887
+ eventType: string
888
+ outcome?: string | null
889
+ templateId?: string | null
890
+ [k: string]: any
891
+ }
892
+ ```
893
+
894
+ **CommsQueryByUser** (interface)
895
+ ```typescript
896
+ interface CommsQueryByUser {
897
+ userId?: string
898
+ contactId?: string
899
+ from?: string
900
+ to?: string
901
+ limit?: number
902
+ }
903
+ ```
904
+
905
+ **RecipientWithOutcome** (interface)
906
+ ```typescript
907
+ interface RecipientWithOutcome {
908
+ id: string; outcome: string
909
+ }
910
+ ```
911
+
912
+ **CommsRecipientIdsQuery** (interface)
913
+ ```typescript
914
+ interface CommsRecipientIdsQuery {
915
+ broadcastId?: string
916
+ journeyId?: string
917
+ journeyStepId?: string
918
+ idField?: IdField
919
+ from?: string
920
+ to?: string
921
+ limit?: number
922
+ }
923
+ ```
924
+
925
+ **CommsRecipientsWithoutActionQuery** (interface)
926
+ ```typescript
927
+ interface CommsRecipientsWithoutActionQuery {
928
+ broadcastId?: string
929
+ journeyId?: string
930
+ actionId?: string
931
+ appId?: string
932
+ idField?: IdField
933
+ from?: string
934
+ to?: string
935
+ limit?: number
936
+ }
937
+ ```
938
+
939
+ **CommsRecipientsWithActionQuery** (interface)
940
+ ```typescript
941
+ interface CommsRecipientsWithActionQuery {
942
+ broadcastId?: string
943
+ journeyId?: string
944
+ actionId?: string
945
+ appId?: string
946
+ outcome?: string
947
+ idField?: IdField
948
+ includeOutcome?: boolean
949
+ from?: string
950
+ to?: string
951
+ limit?: number
952
+ }
953
+ ```
954
+
955
+ **LogCommunicationEventBody** (interface)
956
+ ```typescript
957
+ interface LogCommunicationEventBody {
958
+ broadcastId?: string
959
+ journeyId?: string
960
+ userId?: string
961
+ contactId?: string
962
+ channel?: string
963
+ eventType: string
964
+ outcome?: string
965
+ templateId?: string
966
+ timestamp?: string
967
+ [k: string]: any
968
+ }
969
+ ```
970
+
971
+ **LogBulkCommunicationEventsBody** (interface)
972
+ ```typescript
973
+ interface LogBulkCommunicationEventsBody {
974
+ params: { broadcastId?: string; journeyId?: string; [k: string]: any }
975
+ ids: string[]
976
+ idField?: IdField
977
+ }
978
+ ```
979
+
980
+ **AppendResult** (interface)
981
+ ```typescript
982
+ interface AppendResult {
983
+ success: true
984
+ }
985
+ ```
986
+
987
+ **AppendBulkResult** (interface)
988
+ ```typescript
989
+ interface AppendBulkResult {
990
+ success: true; count: number
991
+ }
992
+ ```
993
+
994
+ **RecipientsPage** (interface)
995
+ ```typescript
996
+ interface RecipientsPage {
997
+ items: Recipient[]
998
+ total: number
999
+ limit: number
1000
+ offset: number
1001
+ note?: string
1002
+ }
1003
+ ```
1004
+
1005
+ **PushSubscriptionJSON** (interface)
1006
+ ```typescript
1007
+ interface PushSubscriptionJSON {
1008
+ endpoint: string
1009
+ keys?: {
1010
+ p256dh?: string
1011
+ auth?: string
1012
+ }
1013
+ }
1014
+ ```
1015
+
1016
+ **PushVapidResponse** (interface)
1017
+ ```typescript
1018
+ interface PushVapidResponse {
1019
+ publicKey: string
1020
+ }
1021
+ ```
1022
+
1023
+ **PushSubscribeResponse** (interface)
1024
+ ```typescript
1025
+ interface PushSubscribeResponse {
1026
+ ok: true; id: string
1027
+ }
1028
+ ```
1029
+
1030
+ **RegisterPushMethodRequest** (interface)
1031
+ ```typescript
1032
+ interface RegisterPushMethodRequest {
1033
+ contactId: string
1034
+ endpoint: string
1035
+ keys: { p256dh: string; auth: string }
1036
+ meta?: Record<string, any>
1037
+ }
1038
+ ```
1039
+
1040
+ **CommsSettings** (interface)
1041
+ ```typescript
1042
+ interface CommsSettings {
1043
+ unsub?: {
1044
+ requireToken?: boolean
1045
+ secret?: string
1046
+ hasSecret?: boolean
1047
+ }
1048
+ topics?: Record<string, TopicConfig>
1049
+ [k: string]: any
1050
+ }
1051
+ ```
1052
+
1053
+ **TopicConfig** (interface)
1054
+ ```typescript
1055
+ interface TopicConfig {
1056
+ label?: string
1057
+ description?: string
1058
+ labels?: string[]
1059
+ classification?: 'transactional' | 'marketing'
1060
+ defaults?: {
1061
+ channels?: Partial<Record<BroadcastChannel, boolean>>
1062
+ topics?: Record<string, boolean | undefined>
1063
+ policy?: 'opt-in' | 'opt-out'
1064
+ byChannel?: Partial<Record<BroadcastChannel, 'opt-in' | 'opt-out'>>
1065
+ }
1066
+ rules?: {
1067
+ allowChannels?: BroadcastChannel[]
1068
+ allowUnsubscribe?: boolean
1069
+ required?: boolean
1070
+ }
1071
+ [k: string]: any
1072
+ }
1073
+ ```
1074
+
1075
+ **CommsSettingsGetResponse** (interface)
1076
+ ```typescript
1077
+ interface CommsSettingsGetResponse {
1078
+ ok: true
1079
+ settings: CommsSettings
1080
+ }
1081
+ ```
1082
+
1083
+ **CommsPublicTopicsResponse** (interface)
1084
+ ```typescript
1085
+ interface CommsPublicTopicsResponse {
1086
+ ok: true; topics: Record<string, TopicConfig>
1087
+ }
1088
+ ```
1089
+
1090
+ **UnsubscribeQuery** (interface)
1091
+ ```typescript
1092
+ interface UnsubscribeQuery {
1093
+ contactId: string
1094
+ topic?: string
1095
+ channel?: BroadcastChannel
1096
+ token?: string
1097
+ }
1098
+ ```
1099
+
1100
+ **UnsubscribeResponse** (interface)
1101
+ ```typescript
1102
+ interface UnsubscribeResponse {
1103
+ ok: true; applied?: { channels?: Record<string, boolean>; topics?: Record<string, boolean> }
1104
+ }
1105
+ ```
1106
+
1107
+ **CommsConsentUpsertRequest** (interface)
1108
+ ```typescript
1109
+ interface CommsConsentUpsertRequest {
1110
+ contactId: string
1111
+ channels?: ConsentChannels
1112
+ topics?: Record<string, boolean>
1113
+ topicsByChannel?: Partial<Record<BroadcastChannel, Record<string, boolean>>>
1114
+ }
1115
+ ```
1116
+
1117
+ **CommsPreferencesUpsertRequest** (interface)
1118
+ ```typescript
1119
+ interface CommsPreferencesUpsertRequest {
1120
+ contactId: string
1121
+ subject?: { type: SubjectType; id: string; productId?: string }
1122
+ channels?: ConsentChannels
1123
+ topics?: Record<string, boolean>
1124
+ topicsByChannel?: Partial<Record<BroadcastChannel, Record<string, boolean>>>
1125
+ }
1126
+ ```
1127
+
1128
+ **CommsSubscribeRequest** (interface)
1129
+ ```typescript
1130
+ interface CommsSubscribeRequest {
1131
+ contactId: string
1132
+ subject: { type: SubjectType; id: string; productId?: string }
1133
+ subscribe: boolean
1134
+ source?: string
1135
+ }
1136
+ ```
1137
+
1138
+ **CommsSubscribeResponse** (interface)
1139
+ ```typescript
1140
+ interface CommsSubscribeResponse {
1141
+ ok: true; subscriptionId: string
1142
+ }
1143
+ ```
1144
+
1145
+ **CommsSubscriptionCheckQuery** (interface)
1146
+ ```typescript
1147
+ interface CommsSubscriptionCheckQuery {
1148
+ contactId: string
1149
+ subjectType: SubjectType
1150
+ subjectId: string
1151
+ productId?: string
1152
+ }
1153
+ ```
1154
+
1155
+ **CommsSubscriptionCheckResponse** (interface)
1156
+ ```typescript
1157
+ interface CommsSubscriptionCheckResponse {
1158
+ ok: true; subscribed: boolean
1159
+ }
1160
+ ```
1161
+
1162
+ **CommsListMethodsQuery** (interface)
1163
+ ```typescript
1164
+ interface CommsListMethodsQuery {
1165
+ contactId: string
1166
+ type?: BroadcastChannel
1167
+ }
1168
+ ```
1169
+
1170
+ **CommsListMethodsResponse** (interface)
1171
+ ```typescript
1172
+ interface CommsListMethodsResponse {
1173
+ ok: true; methods: import('./contact').CommMethod[]
1174
+ }
1175
+ ```
1176
+
1177
+ **RegisterEmailMethodRequest** (interface)
1178
+ ```typescript
1179
+ interface RegisterEmailMethodRequest {
1180
+ contactId?: string; email?: string; userId?: string
1181
+ }
1182
+ ```
1183
+
1184
+ **RegisterSmsMethodRequest** (interface)
1185
+ ```typescript
1186
+ interface RegisterSmsMethodRequest {
1187
+ contactId?: string; phone?: string; userId?: string
1188
+ }
1189
+ ```
1190
+
1191
+ **RegisterMethodResponse** (interface)
1192
+ ```typescript
1193
+ interface RegisterMethodResponse {
1194
+ ok: true; contactId: string
1195
+ }
1196
+ ```
1197
+
1198
+ **SubscriptionsResolveRequest** (interface)
1199
+ ```typescript
1200
+ interface SubscriptionsResolveRequest {
1201
+ subject: { type: SubjectType; id: string; productId?: string }
1202
+ hints: { userId?: string; pushEndpoint?: string; email?: string; walletObjectId?: string }
1203
+ }
1204
+ ```
1205
+
1206
+ **SubscriptionsResolveResponse** (interface)
1207
+ ```typescript
1208
+ interface SubscriptionsResolveResponse {
1209
+ ok: true
1210
+ subject: { type: SubjectType; id: string; productId?: string }
1211
+ contacts: Array<{
1212
+ contactId: string
1213
+ subscribed: boolean
1214
+ channels?: Partial<Record<BroadcastChannel, boolean>>
1215
+ walletForSubject?: boolean
1216
+ }>
1217
+ anySubscribed: boolean
1218
+ anyMethods: boolean
1219
+ anyWalletForSubject: boolean
1220
+ }
1221
+ ```
1222
+
1223
+ **RecipientId** = `string`
1224
+
1225
+ **Recipient** = `import('./contact').Contact`
1226
+
1227
+ **CommsSettingsPatchBody** = `Partial<CommsSettings>`
1228
+
1229
+ **ConsentChannels** = `Partial<Record<BroadcastChannel, boolean>>`
1230
+
1231
+ ### contact
1232
+
1233
+ **Contact** (interface)
1234
+ ```typescript
1235
+ interface Contact {
1236
+ contactId: string
1237
+ orgId: string
1238
+ userId: string | null
1239
+ firstName: string | null
1240
+ lastName: string | null
1241
+ displayName: string | null
1242
+ company: string | null
1243
+ email: string | null
1244
+ phone: string | null
1245
+ emails?: string[]
1246
+ phones?: string[]
1247
+ tags?: string[]
1248
+ source?: string | null
1249
+ notes?: string | null
1250
+ avatarUrl?: string | null
1251
+ locale?: string | null
1252
+ timezone?: string | null
1253
+ externalIds?: Record<string, any>
1254
+ comms?: CommsState
1255
+ customFields: ContactCustomFields
1256
+ createdAt: string
1257
+ updatedAt: string
1258
+ deletedAt: string | null
1259
+ erasedAt: string | null
1260
+ }
1261
+ ```
1262
+
1263
+ **ContactListResponse** (interface)
1264
+ ```typescript
1265
+ interface ContactListResponse {
1266
+ items: Contact[]
1267
+ limit: number
1268
+ offset: number
1269
+ }
1270
+ ```
1271
+
1272
+ **PublicContactUpsertResponse** (interface)
1273
+ ```typescript
1274
+ interface PublicContactUpsertResponse {
1275
+ ok: boolean
1276
+ contactId: string
1277
+ }
1278
+ ```
1279
+
1280
+ **UserSearchResponse** (interface)
1281
+ ```typescript
1282
+ interface UserSearchResponse {
1283
+ user: {
1284
+ uid: string,
1285
+ displayName: string | null,
1286
+ email: string | null,
1287
+ phoneNumber: string | null,
1288
+ photoURL: string | null
1289
+ },
1290
+ contact: ContactResponse | null
1291
+ existsAsContact: boolean
1292
+ }
1293
+ ```
1294
+
1295
+ **ContactPublic** (interface)
1296
+ ```typescript
1297
+ interface ContactPublic {
1298
+ contactId: string
1299
+ firstName?: string | null
1300
+ lastName?: string | null
1301
+ displayName?: string | null
1302
+ company?: string | null
1303
+ avatarUrl?: string | null
1304
+ locale?: string | null
1305
+ timezone?: string | null
1306
+ email?: string | null
1307
+ phone?: string | null
1308
+ externalIds?: Record<string, any>
1309
+ customFields?: ContactCustomFields
1310
+ }
1311
+ ```
1312
+
1313
+ **PublicGetMyContactResponse** (interface)
1314
+ ```typescript
1315
+ interface PublicGetMyContactResponse {
1316
+ ok: boolean; contact: ContactPublic | null
1317
+ }
1318
+ ```
1319
+
1320
+ **PublicUpdateMyContactResponse** (interface)
1321
+ ```typescript
1322
+ interface PublicUpdateMyContactResponse {
1323
+ ok: boolean; contact: ContactPublic
1324
+ }
1325
+ ```
1326
+
1327
+ **CommMethodMeta** (interface)
1328
+ ```typescript
1329
+ interface CommMethodMeta {
1330
+ pushEndpoint?: string
1331
+ p256dh?: string
1332
+ auth?: string
1333
+ phone?: string
1334
+ email?: string
1335
+ walletObjectId?: string
1336
+ subjectType?: SubjectType
1337
+ subjectId?: string
1338
+ productId?: string
1339
+ }
1340
+ ```
1341
+
1342
+ **CommMethod** (interface)
1343
+ ```typescript
1344
+ interface CommMethod {
1345
+ id?: string
1346
+ type: ChannelName
1347
+ meta?: CommMethodMeta
1348
+ verified?: boolean
1349
+ suppressed?: boolean
1350
+ createdAt?: string
1351
+ }
1352
+ ```
1353
+
1354
+ **Subscription** (interface)
1355
+ ```typescript
1356
+ interface Subscription {
1357
+ id: string // canonical key derived from subject (opaque to clients)
1358
+ subjectType: SubjectType
1359
+ subjectId: string
1360
+ productId?: string | null
1361
+ contactId: string
1362
+ source?: string // e.g., 'api'
1363
+ createdAt?: string
1364
+ deletedAt?: string | null
1365
+ }
1366
+ ```
1367
+
1368
+ **PreferenceEntry** (interface)
1369
+ ```typescript
1370
+ interface PreferenceEntry {
1371
+ subjectType?: SubjectType | null
1372
+ subjectId?: string | null
1373
+ channels?: Partial<Record<ChannelName, boolean>>
1374
+ topics?: Record<string, boolean>
1375
+ topicsByChannel?: Partial<Record<ChannelName, Record<string, boolean>>>
1376
+ updatedAt?: string
1377
+ }
1378
+ ```
1379
+
1380
+ **CommsState** (interface)
1381
+ ```typescript
1382
+ interface CommsState {
1383
+ methods?: CommMethod[]
1384
+ subscriptions?: Subscription[]
1385
+ preferences?: Record<string, PreferenceEntry>
1386
+ }
1387
+ ```
1388
+
1389
+ **BaseField** (interface)
1390
+ ```typescript
1391
+ interface BaseField {
1392
+ key: string
1393
+ label: string
1394
+ type: FieldType
1395
+ widget: FieldWidget
1396
+ visible: boolean
1397
+ editable: boolean
1398
+ readOnly: boolean
1399
+ }
1400
+ ```
1401
+
1402
+ **ContactSchema** (interface)
1403
+ ```typescript
1404
+ interface ContactSchema {
1405
+ version: number // 1
1406
+ fields: CoreField[] // core fields
1407
+ customFields: CustomField[]
1408
+ settings: {
1409
+ publicVisibleFields: string[]
1410
+ publicEditableFields: string[]
1411
+ customFieldsVersion: number
1412
+ }
1413
+ }
1414
+ ```
1415
+
1416
+ **ContactCustomFields** = `Record<string, any>`
1417
+
1418
+ **ContactResponse** = `Contact`
1419
+
1420
+ **ContactCreateRequest** = `Omit<`
1421
+
1422
+ **ContactUpdateRequest** = `Partial<ContactCreateRequest>`
1423
+
1424
+ **PublicContactUpsertRequest** = `Partial<`
1425
+
1426
+ **ContactPatch** = `Partial<`
1427
+
1428
+ **ChannelName** = `import('./broadcasts').BroadcastChannel`
1429
+
1430
+ **SubjectType** = `'product' | 'proof' | 'batch'`
1431
+
1432
+ **FieldWidget** = `'text' | 'email' | 'tel' | 'select' | 'checkbox'`
1433
+
1434
+ **FieldType** = ``
1435
+
1436
+ ### error
1437
+
1438
+ **ErrorResponse** (interface)
1439
+ ```typescript
1440
+ interface ErrorResponse {
1441
+ code: number
1442
+ errorCode?: string
1443
+ message: string
1444
+ details?: Record<string, any>
1445
+ }
1446
+ ```
1447
+
1448
+ ### interaction
1449
+
1450
+ **AdminInteractionsQueryRequest** (interface)
1451
+ ```typescript
1452
+ interface AdminInteractionsQueryRequest {
1453
+ userId?: string
1454
+ contactId?: string
1455
+ appId?: string
1456
+ interactionId?: string
1457
+ interactionIds?: string[]
1458
+ broadcastId?: string
1459
+ outcome?: string | null
1460
+ from?: string
1461
+ to?: string
1462
+ limit?: number
1463
+ includeDeleted?: boolean
1464
+ latestPerEventId?: boolean
1465
+ order?: 'ASC' | 'DESC'
1466
+ include?: Array<'interaction'>
1467
+ }
1468
+ ```
1469
+
1470
+ **AdminInteractionsCountsByOutcomeRequest** (interface)
1471
+ ```typescript
1472
+ interface AdminInteractionsCountsByOutcomeRequest {
1473
+ appId?: string
1474
+ interactionId?: string
1475
+ from?: string
1476
+ to?: string
1477
+ limit?: number
1478
+ dedupeLatest?: boolean
1479
+ idField?: IdField
1480
+ }
1481
+ ```
1482
+
1483
+ **PublicInteractionsCountsByOutcomeRequest** (interface)
1484
+ ```typescript
1485
+ interface PublicInteractionsCountsByOutcomeRequest {
1486
+ appId: string
1487
+ interactionId: string
1488
+ from?: string
1489
+ to?: string
1490
+ limit?: number
1491
+ }
1492
+ ```
1493
+
1494
+ **PublicInteractionsByUserRequest** (interface)
1495
+ ```typescript
1496
+ interface PublicInteractionsByUserRequest {
1497
+ appId?: string
1498
+ interactionId?: string
1499
+ from?: string
1500
+ to?: string
1501
+ limit?: number
1502
+ }
1503
+ ```
1504
+
1505
+ **InteractionEventRow** (interface)
1506
+ ```typescript
1507
+ interface InteractionEventRow {
1508
+ orgId: string
1509
+ collectionId: string
1510
+ timestamp: string
1511
+ appId?: string
1512
+ interactionId?: string
1513
+ broadcastId?: string
1514
+ userId?: string
1515
+ contactId?: string
1516
+ outcome?: string | null
1517
+ metadata?: Record<string, unknown>
1518
+ [k: string]: unknown
1519
+ }
1520
+ ```
1521
+
1522
+ **OutcomeCount** (interface)
1523
+ ```typescript
1524
+ interface OutcomeCount {
1525
+ outcome: string | null; count: number
1526
+ }
1527
+ ```
1528
+
1529
+ **InteractionEventBase** (interface)
1530
+ ```typescript
1531
+ interface InteractionEventBase {
1532
+ collectionId: string,
1533
+ orgId?: string,
1534
+ userId?: string
1535
+ contactId?: string
1536
+ interactionId: string
1537
+ appId?: string
1538
+ broadcastId?: string
1539
+ journeyId?: string
1540
+ productId?: string
1541
+ proofId?: string
1542
+ variantId?: string
1543
+ batchId?: string
1544
+ source?: string,
1545
+ eventType?: string
1546
+ outcome?: string
1547
+ timestamp?: string
1548
+ metadata?: Record<string, unknown>
1549
+ [k: string]: any
1550
+ }
1551
+ ```
1552
+
1553
+ **InteractionPermissions** (interface)
1554
+ ```typescript
1555
+ interface InteractionPermissions {
1556
+ enabled?: boolean
1557
+ requireAuth?: boolean
1558
+ allowPublicSubmit?: boolean
1559
+ allowAnonymousSubmit?: boolean
1560
+ allowedOrigins?: string[]
1561
+ startAt?: string
1562
+ endAt?: string
1563
+ * Enforce uniqueness per user: prevent duplicate submissions for this interaction.
1564
+ * If true, optionally use `uniquePerUserWindowSeconds` to scope the window.
1565
+ uniquePerUser?: boolean
1566
+ uniquePerUserWindowSeconds?: number
1567
+ uniqueOutcome?: string
1568
+ * Public summary visibility (counts, aggregates) without auth.
1569
+ * If false, summaries require `allowAuthenticatedSummary` + user auth.
1570
+ allowPublicSummary?: boolean
1571
+ * Authenticated summary visibility (counts, aggregates) when user is signed in.
1572
+ allowAuthenticatedSummary?: boolean
1573
+ allowOwnRead?: boolean
1574
+ }
1575
+ ```
1576
+
1577
+ **InteractionTypeRecord** (interface)
1578
+ ```typescript
1579
+ interface InteractionTypeRecord {
1580
+ id?: string
1581
+ collectionId: string
1582
+ appId: string
1583
+ permissions?: InteractionPermissions
1584
+ data?: {
1585
+ display?: {
1586
+ title?: string
1587
+ description?: string
1588
+ icon?: string
1589
+ color?: string
1590
+ }
1591
+ interactionType?: string
1592
+ [key: string]: unknown
1593
+ }
1594
+ createdAt: string
1595
+ }
1596
+ ```
1597
+
1598
+ **InteractionTypeList** (interface)
1599
+ ```typescript
1600
+ interface InteractionTypeList {
1601
+ items: InteractionTypeRecord[]
1602
+ limit: number
1603
+ offset: number
1604
+ }
1605
+ ```
1606
+
1607
+ **CreateInteractionTypeBody** (interface)
1608
+ ```typescript
1609
+ interface CreateInteractionTypeBody {
1610
+ id: string
1611
+ appId: string
1612
+ permissions?: InteractionPermissions
1613
+ data?: Record<string, unknown>
1614
+ }
1615
+ ```
1616
+
1617
+ **UpdateInteractionTypeBody** (interface)
1618
+ ```typescript
1619
+ interface UpdateInteractionTypeBody {
1620
+ appId?: string
1621
+ permissions?: InteractionPermissions
1622
+ data?: Record<string, unknown>
1623
+ }
1624
+ ```
1625
+
1626
+ **ListInteractionTypesQuery** (interface)
1627
+ ```typescript
1628
+ interface ListInteractionTypesQuery {
1629
+ appId?: string
1630
+ limit?: number
1631
+ offset?: number
1632
+ }
1633
+ ```
1634
+
1635
+ ### jobs
1636
+
1637
+ **Job** (interface)
1638
+ ```typescript
1639
+ interface Job {
1640
+ id: number
1641
+ task: string
1642
+ payload: any
1643
+ priority: number
1644
+ runAt: string | null
1645
+ createdAt: string
1646
+ attempts: number
1647
+ lastError: string | null
1648
+ lockedAt: string | null
1649
+ key: string | null
1650
+ queueName: string | null
1651
+ status: JobStatus
1652
+ }
1653
+ ```
1654
+
1655
+ **ListJobsQuery** (interface)
1656
+ ```typescript
1657
+ interface ListJobsQuery {
1658
+ state?: JobStatus
1659
+ task?: string
1660
+ limit?: number
1661
+ offset?: number
1662
+ from?: string
1663
+ to?: string
1664
+ }
1665
+ ```
1666
+
1667
+ **JobsPage** (interface)
1668
+ ```typescript
1669
+ interface JobsPage {
1670
+ items: Job[]
1671
+ limit: number
1672
+ offset: number
1673
+ }
1674
+ ```
1675
+
1676
+ **EnqueueAsyncJobRequest** (interface)
1677
+ ```typescript
1678
+ interface EnqueueAsyncJobRequest {
1679
+ task: string
1680
+ payload?: Record<string, any>
1681
+ runAt?: string | Date
1682
+ priority?: number
1683
+ key?: string
1684
+ queueName?: string
1685
+ }
1686
+ ```
1687
+
1688
+ **EnqueueAsyncJobResponse** (interface)
1689
+ ```typescript
1690
+ interface EnqueueAsyncJobResponse {
1691
+ id: number
1692
+ task: string
1693
+ runAt?: string
1694
+ key?: string
1695
+ }
1696
+ ```
1697
+
1698
+ **JobStatus** = `'queued' | 'running' | 'errored'`
1699
+
1700
+ ### journeys
1701
+
1702
+ **JourneyRecord** (interface)
1703
+ ```typescript
1704
+ interface JourneyRecord {
1705
+ id: string
1706
+ collectionId: string
1707
+ appId?: string
1708
+ name: string
1709
+ active: boolean
1710
+ journeyType: 'event_triggered' | 'scheduled'
1711
+ data?: {
1712
+ display?: {
1713
+ title?: string
1714
+ description?: string
1715
+ icon?: string
1716
+ color?: string
1717
+ }
1718
+ steps?: Array<{ id: string; type: string; config?: Record<string, unknown> }>
1719
+ triggers?: Array<{ type: string; config?: Record<string, unknown> }>
1720
+ entryRules?: any[]
1721
+ exitRules?: any[]
1722
+ metadata?: Record<string, unknown>
1723
+ [key: string]: unknown
1724
+ }
1725
+ createdAt: string
1726
+ updatedAt: string
1727
+ }
1728
+ ```
1729
+
1730
+ **JourneyList** (interface)
1731
+ ```typescript
1732
+ interface JourneyList {
1733
+ items: JourneyRecord[]
1734
+ limit: number
1735
+ offset: number
1736
+ }
1737
+ ```
1738
+
1739
+ **ListJourneysQuery** (interface)
1740
+ ```typescript
1741
+ interface ListJourneysQuery {
1742
+ appId?: string
1743
+ active?: boolean
1744
+ journeyType?: 'event_triggered' | 'scheduled'
1745
+ limit?: number
1746
+ offset?: number
1747
+ }
1748
+ ```
1749
+
1750
+ **CreateJourneyBody** (interface)
1751
+ ```typescript
1752
+ interface CreateJourneyBody {
1753
+ appId?: string
1754
+ name: string
1755
+ active?: boolean
1756
+ journeyType: 'event_triggered' | 'scheduled'
1757
+ data?: Record<string, unknown>
1758
+ }
1759
+ ```
1760
+
1761
+ **UpdateJourneyBody** (interface)
1762
+ ```typescript
1763
+ interface UpdateJourneyBody {
1764
+ appId?: string
1765
+ name?: string
1766
+ active?: boolean
1767
+ journeyType?: 'event_triggered' | 'scheduled'
1768
+ data?: Record<string, unknown>
1769
+ }
1770
+ ```
1771
+
1772
+ ### journeysAnalytics
1773
+
1774
+ **JourneyStatsRequest** (interface)
1775
+ ```typescript
1776
+ interface JourneyStatsRequest {
1777
+ idField?: IdField // 'userId' | 'contactId'
1778
+ from?: string
1779
+ to?: string
1780
+ finalStepId?: string
1781
+ stepMappings?: Array<{ stepId: string; interactionId?: string; outcome?: string }>
1782
+ }
1783
+ ```
1784
+
1785
+ **JourneyStatsResponse** (interface)
1786
+ ```typescript
1787
+ interface JourneyStatsResponse {
1788
+ journeyId: string
1789
+ totalEntered: number
1790
+ currentlyActive?: number
1791
+ completed?: number
1792
+ exitedViaGoal?: number
1793
+ lastUpdated: string
1794
+ stepStats: Array<{ stepId: string; entered: number; completed: number; pending: number }>
1795
+ }
1796
+ ```
1797
+
1798
+ **JourneyStepRecipientsRequest** (interface)
1799
+ ```typescript
1800
+ interface JourneyStepRecipientsRequest {
1801
+ status?: 'entered' | 'completed' | 'pending'
1802
+ idField?: IdField
1803
+ interactionId?: string
1804
+ outcome?: string
1805
+ from?: string
1806
+ to?: string
1807
+ limit?: number
1808
+ }
1809
+ ```
1810
+
1811
+ **JourneyFunnelReportRequest** (interface)
1812
+ ```typescript
1813
+ interface JourneyFunnelReportRequest {
1814
+ idField?: IdField
1815
+ periodStart?: string
1816
+ periodEnd?: string
1817
+ stepMappings: Array<{ stepId: string; interactionId?: string; outcome?: string }>
1818
+ }
1819
+ ```
1820
+
1821
+ **JourneyFunnelReportResponse** (interface)
1822
+ ```typescript
1823
+ interface JourneyFunnelReportResponse {
1824
+ journeyId: string
1825
+ periodStart: string | null
1826
+ periodEnd: string | null
1827
+ steps: Array<{
1828
+ stepId: string
1829
+ enteredCount: number
1830
+ completedCount: number
1831
+ conversionRate: number
1832
+ avgTimeToComplete: number | null
1833
+ }>
1834
+ }
1835
+ ```
1836
+
1837
+ **JourneyStepRecipientsResponse** = `string[]`
1838
+
1839
+ ### location
1840
+
1841
+ **Location** (interface)
1842
+ ```typescript
1843
+ interface Location {
1844
+ locationId: string
1845
+ collectionId: string | null
1846
+ scope: 'global' | 'collection'
1847
+ name: string
1848
+ category?: string
1849
+ description?: string
1850
+ countryName?: string
1851
+ countryCode?: string
1852
+ websiteUrl?: string
1853
+ logoUrl?: string
1854
+ phone?: string
1855
+ email?: string
1856
+ geofence?: Geofence | {}
1857
+ metadata?: Record<string, unknown>
1858
+ createdAt: string
1859
+ updatedAt: string
1860
+ }
1861
+ ```
1862
+
1863
+ **LocationSearchQuery** (interface)
1864
+ ```typescript
1865
+ interface LocationSearchQuery {
1866
+ q?: string
1867
+ category?: string
1868
+ countryCode?: string
1869
+ countryName?: string
1870
+ limit?: number // default 20; max 100
1871
+ sort?: 'name' | 'countryCode' | 'countryName' // default 'name'
1872
+ }
1873
+ ```
1874
+
1875
+ **LocationSearchResponse** (interface)
1876
+ ```typescript
1877
+ interface LocationSearchResponse {
1878
+ items: Location[]
1879
+ count: number
1880
+ }
1881
+ ```
1882
+
1883
+ **Geofence** = ``
1884
+
1885
+ **LocationPayload** = `Omit<`
1886
+
1887
+ ### nfc
1888
+
1889
+ **NfcTagInfo** (interface)
1890
+ ```typescript
1891
+ interface NfcTagInfo {
1892
+ id: string
1893
+ tagId: string
1894
+ claimSetId: string
1895
+ collectionId?: string
1896
+ productId?: string
1897
+ batchId?: string
1898
+ variantId?: string
1899
+ proofId?: string
1900
+ index?: number
1901
+ data?: Record<string, any>
1902
+ }
1903
+ ```
1904
+
1905
+ **NfcValidateRequest** (interface)
1906
+ ```typescript
1907
+ interface NfcValidateRequest {
1908
+ claimSetId: string
1909
+ codeId: string
1910
+ mirror?: string
1911
+ userId?: string
1912
+ }
1913
+ ```
1914
+
1915
+ **NfcValidateResponse** (interface)
1916
+ ```typescript
1917
+ interface NfcValidateResponse {
1918
+ claimSetId: string
1919
+ codeId: string
1920
+ tagId: string
1921
+ index?: number
1922
+ isAdmin: boolean
1923
+ path?: string
1924
+ collectionId?: string
1925
+ collection?: Record<string, any>
1926
+ count: number,
1927
+ previousCount: number
1928
+ data?: Record<string, any>
1929
+ productId?: string
1930
+ product?: Record<string, any>
1931
+ batchId?: string
1932
+ variantId?: string
1933
+ proofId?: string
1934
+ }
1935
+ ```
1936
+
1937
+ **NfcClaimTagRequest** (interface)
1938
+ ```typescript
1939
+ interface NfcClaimTagRequest {
1940
+ claimSetId: string
1941
+ codeId: string
1942
+ data: Record<string, any>
1943
+ }
1944
+ ```
1945
+
1946
+ ### product
1947
+
1948
+ **Product** (interface)
1949
+ ```typescript
1950
+ interface Product {
1951
+ id: string
1952
+ name: string
1953
+ collectionId: string
1954
+ description: string
1955
+ gtin?: string
1956
+ type?: string
1957
+ heroImage: {
1958
+ url: string
1959
+ thumbnails: {
1960
+ x100: string
1961
+ x200: string
1962
+ x512: string
1963
+ }
1964
+ }
1965
+ tags: {
1966
+ [tagName: string]: boolean
1967
+ } // Flexible map of tags with true/false values
1968
+ data: {
1969
+ [key: string]: any
1970
+ } // Flexible key/value data map
1971
+ }
1972
+ ```
1973
+
1974
+ **ProductResponse** = `Product`
1975
+
1976
+ **ProductCreateRequest** = `Omit<Product, 'id' | 'collectionId'>`
1977
+
1978
+ **ProductUpdateRequest** = `Partial<Omit<Product, 'id' | 'collectionId'>>`
1979
+
1980
+ ### proof
1981
+
1982
+ **Proof** (interface)
1983
+ ```typescript
1984
+ interface Proof {
1985
+ collectionId: string
1986
+ createdAt: string
1987
+ id: string
1988
+ productId: string
1989
+ tokenId: string
1990
+ userId: string
1991
+ claimable?: boolean
1992
+ virtual?: boolean
1993
+ values: Record<string, any>
1994
+ }
1995
+ ```
1996
+
1997
+ **ProofCreateRequest** (interface)
1998
+ ```typescript
1999
+ interface ProofCreateRequest {
2000
+ values: Record<string, any>
2001
+ claimable?: boolean
2002
+ virtual?: boolean
2003
+ }
2004
+ ```
2005
+
2006
+ **ProofResponse** = `Proof`
2007
+
2008
+ **ProofUpdateRequest** = `Partial<ProofCreateRequest>`
2009
+
2010
+ **ProofClaimRequest** = `Record<string, any>`
2011
+
2012
+ ### qr
2013
+
2014
+ **QrShortCodeLookupResponse** (interface)
2015
+ ```typescript
2016
+ interface QrShortCodeLookupResponse {
2017
+ collectionId?: string
2018
+ productId?: string
2019
+ proofId?: string
2020
+ code: string
2021
+ }
2022
+ ```
2023
+
2024
+ ### realtime
2025
+
2026
+ **RealtimeTokenRequest** (interface)
2027
+ ```typescript
2028
+ interface RealtimeTokenRequest {
2029
+ collectionId: string
2030
+ appId?: string
2031
+ }
2032
+ ```
2033
+
2034
+ **AblyTokenRequest** (interface)
2035
+ ```typescript
2036
+ interface AblyTokenRequest {
2037
+ keyName: string
2038
+ ttl: number
2039
+ timestamp: number
2040
+ capability: string
2041
+ nonce: string
2042
+ mac: string
2043
+ clientId: string
2044
+ }
2045
+ ```
2046
+
2047
+ **RealtimeChannelPattern** = `string`
2048
+
2049
+ ### segments
2050
+
2051
+ **SegmentRecord** (interface)
2052
+ ```typescript
2053
+ interface SegmentRecord {
2054
+ id: string
2055
+ collectionId: string
2056
+ appId?: string
2057
+ name: string
2058
+ filterType: 'dynamic' | 'static'
2059
+ estimatedCount?: number
2060
+ lastCalculatedAt?: string
2061
+ createdAt: string
2062
+ data?: {
2063
+ filterRules: any[]
2064
+ description?: string
2065
+ staticContactIds?: string[]
2066
+ [key: string]: unknown
2067
+ }
2068
+ }
2069
+ ```
2070
+
2071
+ **ListSegmentsQuery** (interface)
2072
+ ```typescript
2073
+ interface ListSegmentsQuery {
2074
+ appId?: string
2075
+ filterType?: 'dynamic' | 'static'
2076
+ limit?: number
2077
+ offset?: number
2078
+ }
2079
+ ```
2080
+
2081
+ **SegmentList** (interface)
2082
+ ```typescript
2083
+ interface SegmentList {
2084
+ items: SegmentRecord[]
2085
+ limit: number
2086
+ offset: number
2087
+ }
2088
+ ```
2089
+
2090
+ **SegmentCalculateResult** (interface)
2091
+ ```typescript
2092
+ interface SegmentCalculateResult {
2093
+ scheduled: boolean
2094
+ lastCalculatedAt?: string
2095
+ estimatedCount?: number | null
2096
+ note?: string
2097
+ }
2098
+ ```
2099
+
2100
+ **SegmentRecipientsResponse** (interface)
2101
+ ```typescript
2102
+ interface SegmentRecipientsResponse {
2103
+ items: import('./comms').Recipient[]
2104
+ limit: number
2105
+ offset: number
2106
+ total: number
2107
+ note?: string
2108
+ }
2109
+ ```
2110
+
2111
+ ### template
2112
+
2113
+ **TemplateBase** (interface)
2114
+ ```typescript
2115
+ interface TemplateBase {
2116
+ id: string
2117
+ collectionId: string
2118
+ name: string
2119
+ description?: string
2120
+ type: 'pdf' | 'email' | 'multichannel' | 'label'
2121
+ resizeMode?: string
2122
+ pdf?: {
2123
+ base: { url: string }
2124
+ orientation: 'portrait' | 'landscape'
2125
+ }
2126
+ channels?: {
2127
+ email?: {subject: string; body: string},
2128
+ sms?: { body: string },
2129
+ push: { title: string; body: string, url?: string, iconUrl?: string },
2130
+ wallet?: { header: string; body: string; imageUri?: string }
2131
+ }
2132
+ parameters: TemplateParameterSchema[]
2133
+ subject?: string
2134
+ body?: string
2135
+ css?: string
2136
+ public?: boolean
2137
+ engine?: string
2138
+ component?: string
2139
+ defaultProps?: Record<string, any>
2140
+ collections?: string[]
2141
+ [k: string]: any
2142
+ }
2143
+ ```
2144
+
2145
+ **TemplateRenderRequest** (interface)
2146
+ ```typescript
2147
+ interface TemplateRenderRequest {
2148
+ props: Record<string, any>
2149
+ }
2150
+ ```
2151
+
2152
+ **TemplateRenderResponse** (interface)
2153
+ ```typescript
2154
+ interface TemplateRenderResponse {
2155
+ ok: boolean; html: string
2156
+ }
2157
+ ```
2158
+
2159
+ **TemplateRenderSourceRequest** (interface)
2160
+ ```typescript
2161
+ interface TemplateRenderSourceRequest {
2162
+ engine: 'liquid'
2163
+ source: string
2164
+ props?: Record<string, any>
2165
+ component?: string
2166
+ }
2167
+ ```
2168
+
2169
+ **TemplateRenderSourceResponse** (interface)
2170
+ ```typescript
2171
+ interface TemplateRenderSourceResponse {
2172
+ ok: boolean; html: string
2173
+ }
2174
+ ```
2175
+
2176
+ **TemplateInput** = `Omit<TemplateBase, 'id' | 'collectionId'>`
2177
+
2178
+ **TemplateUpdate** = `Partial<Omit<TemplateBase, 'id' | 'collectionId'>>`
2179
+
2180
+ **TemplatePublic** = `TemplateBase`
2181
+
2182
+ ### variant
2183
+
2184
+ **VariantResponse** = `any`
2185
+
2186
+ **VariantCreateRequest** = `any`
2187
+
2188
+ **VariantUpdateRequest** = `any`
2189
+
2190
+ ### ai (api)
2191
+
2192
+ **AIGenerateContentRequest** (interface)
2193
+ ```typescript
2194
+ interface AIGenerateContentRequest {
2195
+ contents: string | any
2196
+ responseMimeType?: string
2197
+ systemInstruction?: string
2198
+ provider?: string
2199
+ model?: string
2200
+ [key: string]: any
2201
+ }
2202
+ ```
2203
+
2204
+ **AIGenerateImageRequest** (interface)
2205
+ ```typescript
2206
+ interface AIGenerateImageRequest {
2207
+ prompt: string
2208
+ provider?: string
2209
+ model?: string
2210
+ size?: string
2211
+ [key: string]: any
2212
+ }
2213
+ ```
2214
+
2215
+ **AISearchPhotosRequest** (interface)
2216
+ ```typescript
2217
+ interface AISearchPhotosRequest {
2218
+ query: string
2219
+ per_page?: number
2220
+ orientation?: 'landscape' | 'portrait' | 'squarish'
2221
+ [key: string]: any
2222
+ }
2223
+ ```
2224
+
2225
+ **AISearchPhotosPhoto** (interface)
2226
+ ```typescript
2227
+ interface AISearchPhotosPhoto {
2228
+ url: string
2229
+ alt?: string
2230
+ photographer?: string
2231
+ photographerUrl?: string
2232
+ [key: string]: any
2233
+ }
2234
+ ```
2235
+
2236
+ ### appConfiguration (api)
2237
+
2238
+ **AppConfigOptions** (type)
2239
+ ```typescript
2240
+ type AppConfigOptions = {
2241
+ appId: string
2242
+ collectionId?: string
2243
+ productId?: string
2244
+ variantId?: string
2245
+ batchId?: string
2246
+ itemId?: string
2247
+ user?: boolean
2248
+ userData?: boolean
2249
+ admin?: boolean
2250
+ config?: any
2251
+ data?: any
2252
+ }
2253
+ ```
2254
+
2255
+ ### auth (api)
2256
+
2257
+ **LoginResponse** (type)
2258
+ ```typescript
2259
+ type LoginResponse = {
2260
+ id: string
2261
+ name: string
2262
+ email: string
2263
+ bearerToken: string
2264
+ account: Record<string, any>
2265
+ }
2266
+ ```
2267
+
2268
+ **VerifyTokenResponse** (type)
2269
+ ```typescript
2270
+ type VerifyTokenResponse = {
2271
+ valid: boolean
2272
+ id?: string
2273
+ name?: string
2274
+ email?: string
2275
+ account?: Record<string, any>
2276
+ }
2277
+ ```
2278
+
2279
+ **AccountInfoResponse** (type)
2280
+ ```typescript
2281
+ type AccountInfoResponse = {
2282
+ accessType: string;
2283
+ analyticsCode: string;
2284
+ analyticsId: string;
2285
+ auth_time: number;
2286
+ baseCollectionId: string;
2287
+ clientType: string;
2288
+ email: string;
2289
+ email_verified: boolean;
2290
+ features: {
2291
+ actionLogger: boolean;
2292
+ adminCollections: boolean;
2293
+ adminApps: boolean;
2294
+ apiKeys: boolean;
2295
+ adminUsers: boolean;
2296
+ [key: string]: boolean;
2297
+ };
2298
+ iat: number;
2299
+ id: string;
2300
+ iss: string;
2301
+ location: string | null;
2302
+ name: string;
2303
+ picture: string;
2304
+ sites: {
2305
+ [siteName: string]: boolean;
2306
+ };
2307
+ sub: string;
2308
+ uid: string;
2309
+ userId: string;
2310
+ contactId: string
2311
+ whitelabel: {
2312
+ [key: string]: any;
2313
+ }
2314
+ }
2315
+ ```
2316
+
2317
+ ## API Functions
2318
+
2319
+ ### ai
2320
+
2321
+ **generateContent**(collectionId: string,
2322
+ params: AIGenerateContentRequest,
2323
+ admin: boolean = true) → `Promise<any>`
2324
+ Generate text/content via AI (admin)
2325
+
2326
+ **generateImage**(collectionId: string, params: AIGenerateImageRequest) → `Promise<any>`
2327
+ Generate an image via AI (admin)
2328
+
2329
+ **searchPhotos**(collectionId: string,
2330
+ params: AISearchPhotosRequest) → `Promise<AISearchPhotosPhoto[]>`
2331
+ Search stock photos or similar via AI (admin)
2332
+
2333
+ **uploadFile**(collectionId: string, params: any) → `Promise<any>`
2334
+ Upload a file for AI usage (admin). Pass FormData for binary uploads.
2335
+
2336
+ **createCache**(collectionId: string, params: any) → `Promise<any>`
2337
+ Create or warm a cache for AI (admin)
2338
+
2339
+ **postChat**(collectionId: string, params: any, admin: boolean = true) → `Promise<any>`
2340
+ Post a chat message to the AI (admin or public)
2341
+
2342
+ ### appConfiguration
2343
+
2344
+ **getConfig**(opts: AppConfigOptions) → `Promise<any>`
2345
+
2346
+ **setConfig**(opts: AppConfigOptions) → `Promise<any>`
2347
+
2348
+ **deleteConfig**(opts: AppConfigOptions) → `Promise<void>`
2349
+
2350
+ **getData**(opts: AppConfigOptions) → `Promise<any[]>`
2351
+
2352
+ **getDataItem**(opts: AppConfigOptions) → `Promise<any>`
2353
+
2354
+ **setDataItem**(opts: AppConfigOptions) → `Promise<any>`
2355
+
2356
+ **deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
2357
+
2358
+ ### appRecord
2359
+
2360
+ **get**(collectionId: string, appId: string) → `Promise<any>`
2361
+
2362
+ **create**(collectionId: string, appId: string, data: any) → `Promise<any>`
2363
+
2364
+ **update**(collectionId: string, appId: string, data: any) → `Promise<any>`
2365
+
2366
+ **remove**(collectionId: string, appId: string) → `Promise<void>`
2367
+
2368
+ ### asset
2369
+
2370
+ **upload**(options: UploadAssetOptions) → `Promise<Asset>`
2371
+ Upload an asset file
2372
+
2373
+ **getForCollection**(collectionId: string,
2374
+ assetId: string) → `Promise<AssetResponse>`
2375
+ Upload an asset file
2376
+
2377
+ **listForCollection**(collectionId: string) → `Promise<AssetResponse[]>`
2378
+ Upload an asset file
2379
+
2380
+ **getForProduct**(collectionId: string,
2381
+ productId: string,
2382
+ assetId: string) → `Promise<AssetResponse>`
2383
+ Upload an asset file
2384
+
2385
+ **listForProduct**(collectionId: string,
2386
+ productId: string) → `Promise<AssetResponse[]>`
2387
+ Upload an asset file
2388
+
2389
+ **getForProof**(collectionId: string,
2390
+ productId: string,
2391
+ proofId: string,
2392
+ assetId: string) → `Promise<AssetResponse>`
2393
+ Upload an asset file
2394
+
2395
+ **listForProof**(collectionId: string,
2396
+ productId: string,
2397
+ proofId: string,
2398
+ appId?: string) → `Promise<AssetResponse[]>`
2399
+ Upload an asset file
2400
+
2401
+ **uploadAsset**(collectionId: string,
2402
+ productId: string,
2403
+ proofId: string,
2404
+ file: File,
2405
+ extraData?: Record<string, any>,
2406
+ onProgress?: (percent: number) → `void`
2407
+ Uploads an asset file to a proof, with optional extraData as JSON. Supports progress reporting via onProgress callback (browser only).
2408
+
2409
+ **list**(options: ListAssetsOptions) → `Promise<Asset[]>`
2410
+ List assets for a given scope
2411
+
2412
+ **get**(options: GetAssetOptions) → `Promise<Asset>`
2413
+ Get an asset by id within a scope (public)
2414
+
2415
+ **remove**(options: RemoveAssetOptions) → `Promise<void>`
2416
+ Remove an asset by id within a scope (admin)
2417
+
2418
+ ### async
2419
+
2420
+ **enqueueAsyncJob**(collectionId: string,
2421
+ params: EnqueueAsyncJobRequest) → `Promise<EnqueueAsyncJobResponse>`
2422
+ Enqueue a background job for a collection POST /admin/collection/:collectionId/async/jobs (202)
2423
+
2424
+ **getAsyncJobStatus**(collectionId: string,
2425
+ jobId: number) → `Promise<Job>`
2426
+ Get job status by ID (may return 404 if completed/removed) GET /admin/collection/:collectionId/async/jobs/:jobId
2427
+
2428
+ ### attestation
2429
+
2430
+ **list**(collectionId: string,
2431
+ productId: string,
2432
+ proofId: string) → `Promise<AttestationResponse[]>`
2433
+ List all attestations for a proof.
2434
+
2435
+ **get**(collectionId: string,
2436
+ productId: string,
2437
+ proofId: string,
2438
+ attestationId: string) → `Promise<AttestationResponse>`
2439
+ Get a single attestation by ID.
2440
+
2441
+ **create**(collectionId: string,
2442
+ productId: string,
2443
+ proofId: string,
2444
+ data: AttestationCreateRequest) → `Promise<AttestationResponse>`
2445
+ Create a new attestation for a proof.
2446
+
2447
+ **update**(collectionId: string,
2448
+ productId: string,
2449
+ proofId: string,
2450
+ attestationId: string,
2451
+ data: AttestationUpdateRequest) → `Promise<AttestationResponse>`
2452
+ Update an attestation.
2453
+
2454
+ **remove**(collectionId: string,
2455
+ productId: string,
2456
+ proofId: string,
2457
+ attestationId: string) → `Promise<void>`
2458
+ Delete an attestation.
2459
+
2460
+ ### auth
2461
+
2462
+ **login**(email: string, password: string) → `Promise<LoginResponse>`
2463
+ Login with email and password. Sets the bearerToken for subsequent API calls.
2464
+
2465
+ **logout**() → `void`
2466
+ Logout (clears bearerToken for future API calls).
2467
+
2468
+ **verifyToken**(token?: string) → `Promise<VerifyTokenResponse>`
2469
+ Verifies the current bearerToken (or a provided token). Returns user/account info if valid.
2470
+
2471
+ **requestAdminJWT**(collectionId: string) → `Promise<string>`
2472
+ Requests an admin JWT for the current user and a specific collection Returns JWT if valid.
2473
+
2474
+ **requestPublicJWT**(collectionId: string, productId: string, proofId: string) → `Promise<string>`
2475
+ Requests a JWT for the current user and a specific collection/product/proof Validates if the user has access to the resource, and returns a JWT
2476
+
2477
+ **registerUser**(user: UserAccountRegistrationRequest) → `Promise<LoginResponse>`
2478
+ Tries to register a new user account. Can return a bearer token, or a Firebase token
2479
+
2480
+ **getUserToken**(opts?: {
2481
+ email?: string
2482
+ collectionId?: string
2483
+ userId?: string
2484
+ expiry?: string
2485
+ }) → `Promise<`
2486
+ Admin: Get a user bearer token (impersonation/automation). POST /admin/auth/userToken All fields are optional; at least one identifier should be provided.
2487
+
2488
+ **getAccount**() → `Promise<AccountInfoResponse>`
2489
+ Gets current account information for the logged in user. Returns user, owner, account, and location objects.
2490
+
2491
+ ### authKit
2492
+
2493
+ **login**(clientId: string, email: string, password: string) → `Promise<AuthLoginResponse>`
2494
+ Login with email + password (public).
2495
+
2496
+ **register**(clientId: string, data: { email: string; password: string; displayName?: string; accountData?: Record<string, any> }) → `Promise<AuthLoginResponse>`
2497
+ Register a new user (public).
2498
+
2499
+ **googleLogin**(clientId: string, idToken: string) → `Promise<AuthLoginResponse>`
2500
+ Google OAuth login (public).
2501
+
2502
+ **sendMagicLink**(clientId: string, data: { email: string; redirectUrl: string; accountData?: Record<string, any> }) → `Promise<MagicLinkSendResponse>`
2503
+ Send a magic link email to the user (public).
2504
+
2505
+ **verifyMagicLink**(clientId: string, token: string) → `Promise<MagicLinkVerifyResponse>`
2506
+ Verify a magic link token and authenticate/create the user (public).
2507
+
2508
+ **sendPhoneCode**(clientId: string, phoneNumber: string) → `Promise<PhoneSendCodeResponse>`
2509
+ Send phone verification code (public).
2510
+
2511
+ **verifyPhoneCode**(clientId: string, phoneNumber: string, code: string) → `Promise<PhoneVerifyResponse>`
2512
+ Verify phone verification code (public).
2513
+
2514
+ **requestPasswordReset**(clientId: string, data: { email: string; redirectUrl?: string; clientName?: string }) → `Promise<PasswordResetRequestResponse>`
2515
+ Verify phone verification code (public).
2516
+
2517
+ **verifyResetToken**(clientId: string, token: string) → `Promise<VerifyResetTokenResponse>`
2518
+ Verify phone verification code (public).
2519
+
2520
+ **completePasswordReset**(clientId: string, token: string, newPassword: string) → `Promise<PasswordResetCompleteResponse>`
2521
+ Verify phone verification code (public).
2522
+
2523
+ **sendEmailVerification**(clientId: string, data: { userId: string; email: string; redirectUrl?: string; clientName?: string }) → `Promise<EmailVerificationActionResponse>`
2524
+ Verify phone verification code (public).
2525
+
2526
+ **verifyEmail**(clientId: string, token: string) → `Promise<EmailVerifyTokenResponse>`
2527
+ Verify phone verification code (public).
2528
+
2529
+ **resendEmailVerification**(clientId: string, data: { userId: string; email: string; redirectUrl?: string; clientName?: string }) → `Promise<EmailVerificationActionResponse>`
2530
+ Verify phone verification code (public).
2531
+
2532
+ **getProfile**(clientId: string) → `Promise<UserProfile>`
2533
+ Verify phone verification code (public).
2534
+
2535
+ **updateProfile**(clientId: string, data: ProfileUpdateData) → `Promise<UserProfile>`
2536
+ Verify phone verification code (public).
2537
+
2538
+ **changePassword**(clientId: string, currentPassword: string, newPassword: string) → `Promise<SuccessResponse>`
2539
+ Verify phone verification code (public).
2540
+
2541
+ **changeEmail**(clientId: string, newEmail: string, password: string, redirectUrl: string) → `Promise<SuccessResponse>`
2542
+ Verify phone verification code (public).
2543
+
2544
+ **verifyEmailChange**(clientId: string, token: string) → `Promise<SuccessResponse>`
2545
+ Verify phone verification code (public).
2546
+
2547
+ **updatePhone**(clientId: string, phoneNumber: string, verificationCode: string) → `Promise<SuccessResponse>`
2548
+ Verify phone verification code (public).
2549
+
2550
+ **deleteAccount**(clientId: string, password: string, confirmText: string) → `Promise<SuccessResponse>`
2551
+ Verify phone verification code (public).
2552
+
2553
+ **load**(authKitId: string) → `Promise<AuthKitConfig>`
2554
+ Verify phone verification code (public).
2555
+
2556
+ **get**(collectionId: string, authKitId: string) → `Promise<AuthKitConfig>`
2557
+ Verify phone verification code (public).
2558
+
2559
+ **list**(collectionId: string, admin?: boolean) → `Promise<AuthKitConfig[]>`
2560
+ Verify phone verification code (public).
2561
+
2562
+ **create**(collectionId: string, data: any) → `Promise<AuthKitConfig>`
2563
+ Verify phone verification code (public).
2564
+
2565
+ **update**(collectionId: string, authKitId: string, data: any) → `Promise<AuthKitConfig>`
2566
+ Verify phone verification code (public).
2567
+
2568
+ **remove**(collectionId: string, authKitId: string) → `Promise<void>`
2569
+ Verify phone verification code (public).
2570
+
2571
+ ### batch
2572
+
2573
+ **get**(collectionId: string,
2574
+ productId: string,
2575
+ batchId: string) → `Promise<BatchResponse>`
2576
+ Get a single batch by ID for a collection and product (admin only).
2577
+
2578
+ **list**(collectionId: string,
2579
+ productId: string) → `Promise<BatchResponse[]>`
2580
+ List all batches for a collection and product (admin only).
2581
+
2582
+ **create**(collectionId: string,
2583
+ productId: string,
2584
+ data: BatchCreateRequest) → `Promise<BatchResponse>`
2585
+ Create a new batch for a collection and product (admin only).
2586
+
2587
+ **update**(collectionId: string,
2588
+ productId: string,
2589
+ batchId: string,
2590
+ data: BatchUpdateRequest) → `Promise<BatchResponse>`
2591
+ Update a batch for a collection and product (admin only).
2592
+
2593
+ **remove**(collectionId: string,
2594
+ productId: string,
2595
+ batchId: string) → `Promise<void>`
2596
+ Delete a batch for a collection and product (admin only).
2597
+
2598
+ **getPublic**(collectionId: string,
2599
+ productId: string,
2600
+ batchId: string) → `Promise<BatchResponse>`
2601
+ Get a single batch by ID for a collection and product (public endpoint).
2602
+
2603
+ **getSN**(collectionId: string,
2604
+ productId: string,
2605
+ batchId: string,
2606
+ startIndex: number = 0,
2607
+ count: number = 10) → `Promise<any>`
2608
+ Get serial numbers for a batch (admin only).
2609
+
2610
+ **lookupSN**(collectionId: string,
2611
+ productId: string,
2612
+ batchId: string,
2613
+ codeId: string) → `Promise<any>`
2614
+ Look up a serial number by code for a batch (admin only).
2615
+
2616
+ ### broadcasts
2617
+
2618
+ **create**(collectionId: string,
2619
+ body: Omit<BroadcastRecord, 'id' | 'collectionId' | 'createdAt'>) → `Promise<BroadcastRecord>`
2620
+
2621
+ **list**(collectionId: string,
2622
+ query: ListBroadcastsQuery = {}) → `Promise<BroadcastList>`
2623
+
2624
+ **get**(collectionId: string,
2625
+ id: string) → `Promise<BroadcastRecord>`
2626
+
2627
+ **update**(collectionId: string,
2628
+ id: string,
2629
+ body: Partial<Omit<BroadcastRecord, 'id' | 'collectionId' | 'createdAt'>>) → `Promise<BroadcastRecord>`
2630
+
2631
+ **remove**(collectionId: string,
2632
+ id: string) → `Promise<void>`
2633
+
2634
+ **recipients**(collectionId: string,
2635
+ id: string,
2636
+ query: { limit?: number; offset?: number } = {}) → `Promise<BroadcastRecipientsResponse>`
2637
+
2638
+ **preview**(collectionId: string,
2639
+ id: string,
2640
+ body: BroadcastPreviewRequest) → `Promise<BroadcastPreviewResponse>`
2641
+
2642
+ **send**(collectionId: string,
2643
+ id: string,
2644
+ body: BroadcastSendRequest = {}) → `Promise<`
2645
+
2646
+ **sendTest**(collectionId: string,
2647
+ id: string,
2648
+ body: BroadcastSendTestRequest) → `Promise<BroadcastSendTestResponse>`
2649
+
2650
+ **sendManual**(collectionId: string,
2651
+ id: string,
2652
+ body: BroadcastSendManualRequest) → `Promise<BroadcastSendManualResponse>`
2653
+
2654
+ **append**(collectionId: string,
2655
+ body: BroadcastAppendEventBody) → `Promise<AppendResult>`
2656
+
2657
+ **appendBulk**(collectionId: string,
2658
+ body: BroadcastAppendBulkBody) → `Promise<AppendBulkResult>`
2659
+
2660
+ ### claimSet
2661
+
2662
+ **getAllForCollection**(collectionId: string) → `Promise<any[]>`
2663
+ Get all claim sets for a collection.
2664
+
2665
+ **getForCollection**(collectionId: string, claimSetId: string) → `Promise<any>`
2666
+ Get a specific claim set for a collection.
2667
+
2668
+ **getAllTags**(collectionId: string, claimSetId: string) → `Promise<any[]>`
2669
+ Get all tags for a claim set.
2670
+
2671
+ **getReport**(collectionId: string, claimSetId: string) → `Promise<any>`
2672
+ Get a report for a claim set.
2673
+
2674
+ **getAssignedTags**(collectionId: string, claimSetId: string) → `Promise<any>`
2675
+ Get assigned tags for a claim set.
2676
+
2677
+ **getTagSummary**(collectionId: string) → `Promise<any>`
2678
+ Get tag summary for a collection.
2679
+
2680
+ **tagQuery**(collectionId: string, data: any) → `Promise<any>`
2681
+ Perform a tag query for a collection.
2682
+
2683
+ **createForCollection**(collectionId: string, params: any) → `Promise<any>`
2684
+ Create a new claim set for a collection.
2685
+
2686
+ **updateForCollection**(collectionId: string, params: any) → `Promise<any>`
2687
+ Update a claim set for a collection.
2688
+
2689
+ **makeClaim**(collectionId: string, params: any) → `Promise<any>`
2690
+ Make a claim for a claim set.
2691
+
2692
+ **assignClaims**(collectionId: string, data: AssignClaimsRequest) → `Promise<any>`
2693
+ Assign claims to a claim set. { id: string, // claim set id (required) collectionId: string,// required productId: string, // required batchId?: string, // optional start?: number, // optional bulk range start end?: number, // optional bulk range end codeId?: string, // optional single code data?: { [k: string]: any } // optional claim key/values }
2694
+
2695
+ **updateClaimData**(collectionId: string, data: UpdateClaimDataRequest) → `Promise<any>`
2696
+ Update claim data for a collection.
2697
+
2698
+ ### collection
2699
+
2700
+ **get**(collectionId: string, admin?: boolean) → `Promise<CollectionResponse>`
2701
+ Retrieves a single Collection by its ID.
2702
+
2703
+ **list**(admin?: boolean) → `Promise<CollectionResponse[]>`
2704
+ Retrieves all Collections.
2705
+
2706
+ **getShortId**(shortId: string) → `Promise<CollectionResponse>`
2707
+ Retrieve a collection by its shortId (public endpoint).
2708
+
2709
+ **getSettings**(collectionId: string, settingGroup: string, admin?: boolean) → `Promise<any>`
2710
+ Retrieve a specific settings group for a collection (public endpoint).
2711
+
2712
+ **updateSettings**(collectionId: string, settingGroup: string, settings: any) → `Promise<any>`
2713
+ Update a specific settings group for a collection (admin endpoint).
2714
+
2715
+ **create**(data: CollectionCreateRequest) → `Promise<CollectionResponse>`
2716
+ Create a new collection (admin only).
2717
+
2718
+ **update**(collectionId: string, data: CollectionUpdateRequest) → `Promise<CollectionResponse>`
2719
+ Update a collection (admin only).
2720
+
2721
+ **remove**(collectionId: string) → `Promise<void>`
2722
+ Delete a collection (admin only).
2723
+
2724
+ **getSN**(collectionId: string,
2725
+ startIndex: number = 0,
2726
+ count: number = 10) → `Promise<any>`
2727
+ Get serial numbers for a collection (admin only).
2728
+
2729
+ **lookupSN**(collectionId: string,
2730
+ codeId: string) → `Promise<any>`
2731
+ Look up a serial number by code for a collection (admin only).
2732
+
2733
+ **assignSN**(collectionId: string,
2734
+ codeId: string,
2735
+ value: any) → `Promise<any>`
2736
+ Assign a value to a serial number for a collection (admin only).
2737
+
2738
+ ### comms
2739
+
2740
+ **getPushVapidPublicKey**(collectionId: string) → `Promise<import("../types/comms").PushVapidResponse>`
2741
+ Public: Get VAPID public key used for Web Push subscriptions. GET /public/collection/:collectionId/comm/push/vapidPublicKey Note: Key may be global; path is collection-scoped for consistency.
2742
+
2743
+ **registerPush**(collectionId: string,
2744
+ body: import("../types/comms") → `void`
2745
+ Public: Register a Web Push subscription under unified comms. POST /public/collection/:collectionId/comm/push/register
2746
+
2747
+ **getSettings**(collectionId: string,
2748
+ opts: { includeSecret?: boolean } = {}) → `Promise<import("../types/comms").CommsSettingsGetResponse>`
2749
+ Admin: Get current comms settings for a collection. GET /admin/collection/:collectionId/comm.settings Optional query: includeSecret=true to include unsub.secret in response.
2750
+
2751
+ **patchSettings**(collectionId: string,
2752
+ body: import("../types/comms") → `void`
2753
+ Admin: Patch comms settings for a collection. PATCH /admin/collection/:collectionId/comm.settings
2754
+
2755
+ **getPublicTopics**(collectionId: string) → `Promise<import("../types/comms").CommsPublicTopicsResponse>`
2756
+ Public: Fetch configured topics for a collection. GET /public/collection/:collectionId/comm/topics
2757
+
2758
+ **unsubscribe**(collectionId: string,
2759
+ query: import("../types/comms") → `void`
2760
+ Public: Unsubscribe a contact from a category or channel. GET /public/collection/:collectionId/comm/unsubscribe
2761
+
2762
+ **upsertConsent**(collectionId: string,
2763
+ body: import("../types/comms") → `void`
2764
+ Public: Upsert default consent for a contact. POST /public/collection/:collectionId/comm/consent
2765
+
2766
+ **upsertPreferences**(collectionId: string,
2767
+ body: import("../types/comms") → `void`
2768
+ Public: Upsert preferences for a specific subject (or default if subject omitted). POST /public/collection/:collectionId/comm/preferences
2769
+
2770
+ **subscribe**(collectionId: string,
2771
+ body: import("../types/comms") → `void`
2772
+ Public: Subscribe/unsubscribe contact to a subject. POST /public/collection/:collectionId/comm/subscribe
2773
+
2774
+ **checkSubscription**(collectionId: string,
2775
+ query: import("../types/comms") → `void`
2776
+ Public: Check subscription status for a subject. GET /public/collection/:collectionId/comm/subscription/check
2777
+
2778
+ **listMethods**(collectionId: string,
2779
+ query: import("../types/comms") → `void`
2780
+ Public: List registered contact methods. GET /public/collection/:collectionId/comm/methods
2781
+
2782
+ **registerEmail**(collectionId: string,
2783
+ body: import("../types/comms") → `void`
2784
+ Public: Register email method for a contact. POST /public/collection/:collectionId/comm/email/register
2785
+
2786
+ **registerSms**(collectionId: string,
2787
+ body: import("../types/comms") → `void`
2788
+ Public: Register SMS method for a contact. POST /public/collection/:collectionId/comm/sms/register
2789
+
2790
+ **resolveSubscriptions**(collectionId: string,
2791
+ body: import("../types/comms") → `void`
2792
+ Public: Resolve contacts for a subject with identity hints. POST /public/collection/:collectionId/comm/subscriptions/resolve
2793
+
2794
+ **queryByUser**(collectionId: string,
2795
+ body: CommsQueryByUser = {}) → `Promise<CommunicationEvent[]>`
2796
+ Analytics: Query communication events by user or contact. POST /admin/collection/:collectionId/comm/query/by-user
2797
+
2798
+ **queryRecipientIds**(collectionId: string,
2799
+ body: CommsRecipientIdsQuery) → `Promise<RecipientId[]>`
2800
+ Analytics: Recipient IDs for a communication source. POST /admin/collection/:collectionId/comm/query/recipient-ids
2801
+
2802
+ **queryRecipientsWithoutAction**(collectionId: string,
2803
+ body: CommsRecipientsWithoutActionQuery) → `Promise<RecipientId[]>`
2804
+ Analytics: Recipients who did not perform an action. POST /admin/collection/:collectionId/comm/query/recipients/without-action
2805
+
2806
+ **queryRecipientsWithAction**(collectionId: string,
2807
+ body: CommsRecipientsWithActionQuery) → `Promise<RecipientId[] | RecipientWithOutcome[]>`
2808
+ Analytics: Recipients who performed an action, optionally with outcome. POST /admin/collection/:collectionId/comm/query/recipients/with-action
2809
+
2810
+ **logCommunicationEvent**(collectionId: string,
2811
+ body: LogCommunicationEventBody) → `Promise<AppendResult>`
2812
+ Logging: Append a single communication event. POST /admin/collection/:collectionId/comm/log
2813
+
2814
+ **logBulkCommunicationEvents**(collectionId: string,
2815
+ body: LogBulkCommunicationEventsBody | ({ sourceId: string; ids: string[]; idField?: 'userId'|'contactId'; [k: string]: any }) → `void`
2816
+ Logging: Append many communication events for a list of IDs. POST /admin/collection/:collectionId/comm/log/bulk
2817
+
2818
+ ### contact
2819
+
2820
+ **create**(collectionId: string, data: ContactCreateRequest) → `Promise<ContactResponse>`
2821
+
2822
+ **list**(collectionId: string,
2823
+ params?: { limit?: number; offset?: number; includeDeleted?: boolean }) → `Promise<ContactListResponse>`
2824
+
2825
+ **get**(collectionId: string,
2826
+ contactId: string,
2827
+ params?: { includeDeleted?: boolean }) → `Promise<ContactResponse>`
2828
+
2829
+ **update**(collectionId: string,
2830
+ contactId: string,
2831
+ data: ContactUpdateRequest) → `Promise<ContactResponse>`
2832
+
2833
+ **remove**(collectionId: string, contactId: string) → `Promise<void>`
2834
+
2835
+ **lookup**(collectionId: string,
2836
+ params: { email?: string; phone?: string }) → `Promise<ContactResponse>`
2837
+
2838
+ **upsert**(collectionId: string,
2839
+ data: ContactCreateRequest) → `Promise<ContactResponse>`
2840
+
2841
+ **publicUpsert**(collectionId: string,
2842
+ data: PublicContactUpsertRequest) → `Promise<PublicContactUpsertResponse>`
2843
+
2844
+ **publicGetMine**(collectionId: string) → `Promise<PublicGetMyContactResponse>`
2845
+
2846
+ **publicUpdateMine**(collectionId: string,
2847
+ data: ContactPatch) → `Promise<PublicUpdateMyContactResponse>`
2848
+
2849
+ **publicGetSchema**(collectionId: string) → `Promise<ContactSchema>`
2850
+
2851
+ **erase**(collectionId: string, contactId: string, body?: any) → `Promise<ContactResponse>`
2852
+
2853
+ **getUser**(collectionId: string,
2854
+ userId: string,) → `Promise<UserSearchResponse>`
2855
+
2856
+ ### crate
2857
+
2858
+ **get**(collectionId: string, crateId: string) → `Promise<any>`
2859
+ Get a single crate by ID for a collection (admin only).
2860
+
2861
+ **list**(collectionId: string) → `Promise<any[]>`
2862
+ List all crates for a collection (admin only).
2863
+
2864
+ **create**(collectionId: string, data: any) → `Promise<any>`
2865
+ Create a new crate for a collection (admin only).
2866
+
2867
+ **update**(collectionId: string, crateId: string, data: any) → `Promise<any>`
2868
+ Update a crate for a collection (admin only).
2869
+
2870
+ **remove**(collectionId: string, crateId: string) → `Promise<void>`
2871
+ Delete a crate for a collection (admin only).
2872
+
2873
+ ### form
2874
+
2875
+ **get**(collectionId: string, formId: string, admin?: boolean) → `Promise<any>`
2876
+ Get a single form by ID for a collection.
2877
+
2878
+ **list**(collectionId: string, admin?: boolean) → `Promise<any[]>`
2879
+ List all forms for a collection.
2880
+
2881
+ **create**(collectionId: string, data: any) → `Promise<any>`
2882
+ Create a new form for a collection (admin only).
2883
+
2884
+ **update**(collectionId: string, formId: string, data: any) → `Promise<any>`
2885
+ Update a form for a collection (admin only).
2886
+
2887
+ **remove**(collectionId: string, formId: string) → `Promise<void>`
2888
+ Delete a form for a collection (admin only).
2889
+
2890
+ ### interactions
2891
+
2892
+ **query**(collectionId: string,
2893
+ body: AdminInteractionsQueryRequest) → `Promise<InteractionEventRow[]>`
2894
+ POST /admin/collection/:collectionId/interactions/query Flexible query for interaction events with optional includes.
2895
+
2896
+ **countsByOutcome**(collectionId: string,
2897
+ query: AdminInteractionsCountsByOutcomeRequest = {}) → `Promise<OutcomeCount[]>`
2898
+ POST /admin/collection/:collectionId/interactions/counts-by-outcome Returns array of { outcome, count }.
2899
+
2900
+ **appendEvent**(collectionId: string,
2901
+ body: AppendInteractionBody) → `Promise<`
2902
+ POST /admin/collection/:collectionId/interactions/append Appends one interaction event.
2903
+
2904
+ **updateEvent**(collectionId: string,
2905
+ body: UpdateInteractionBody) → `Promise<`
2906
+ POST /admin/collection/:collectionId/interactions/append Appends one interaction event.
2907
+
2908
+ **submitPublicEvent**(collectionId: string,
2909
+ body: AppendInteractionBody) → `Promise<`
2910
+ Appends one interaction event from a public source.
2911
+
2912
+ **create**(collectionId: string,
2913
+ body: CreateInteractionTypeBody) → `Promise<InteractionTypeRecord>`
2914
+ Appends one interaction event from a public source.
2915
+
2916
+ **list**(collectionId: string,
2917
+ query: ListInteractionTypesQuery = {}) → `Promise<InteractionTypeList>`
2918
+ Appends one interaction event from a public source.
2919
+
2920
+ **get**(collectionId: string,
2921
+ id: string) → `Promise<InteractionTypeRecord>`
2922
+ Appends one interaction event from a public source.
2923
+
2924
+ **update**(collectionId: string,
2925
+ id: string,
2926
+ patchBody: UpdateInteractionTypeBody) → `Promise<InteractionTypeRecord>`
2927
+ Appends one interaction event from a public source.
2928
+
2929
+ **remove**(collectionId: string,
2930
+ id: string) → `Promise<void>`
2931
+ Appends one interaction event from a public source.
2932
+
2933
+ **publicCountsByOutcome**(collectionId: string,
2934
+ body: PublicInteractionsCountsByOutcomeRequest,
2935
+ authToken?: string) → `Promise<OutcomeCount[]>`
2936
+ Appends one interaction event from a public source.
2937
+
2938
+ **publicMyInteractions**(collectionId: string,
2939
+ body: PublicInteractionsByUserRequest,
2940
+ authToken?: string) → `Promise<InteractionEventRow[]>`
2941
+ Appends one interaction event from a public source.
2942
+
2943
+ **publicList**(collectionId: string,
2944
+ query: ListInteractionTypesQuery = {}) → `Promise<InteractionTypeList>`
2945
+ Appends one interaction event from a public source.
2946
+
2947
+ **publicGet**(collectionId: string,
2948
+ id: string) → `Promise<InteractionTypeRecord>`
2949
+ Appends one interaction event from a public source.
2950
+
2951
+ ### jobs
2952
+
2953
+ **listJobs**(collectionId: string,
2954
+ query: ListJobsQuery = {}) → `Promise<JobsPage>`
2955
+ List visible jobs for a collection GET /admin/collection/:collectionId/jobs
2956
+
2957
+ **getJob**(collectionId: string,
2958
+ jobId: number) → `Promise<Job>`
2959
+ Get a single job GET /admin/collection/:collectionId/jobs/:jobId
2960
+
2961
+ ### journeys
2962
+
2963
+ **create**(collectionId: string,
2964
+ body: CreateJourneyBody) → `Promise<JourneyRecord>`
2965
+
2966
+ **list**(collectionId: string,
2967
+ query: ListJourneysQuery = {}) → `Promise<JourneyList>`
2968
+
2969
+ **get**(collectionId: string,
2970
+ id: string) → `Promise<JourneyRecord>`
2971
+
2972
+ **update**(collectionId: string,
2973
+ id: string,
2974
+ body: UpdateJourneyBody) → `Promise<JourneyRecord>`
2975
+
2976
+ **remove**(collectionId: string,
2977
+ id: string) → `Promise<void>`
2978
+
2979
+ ### journeysAnalytics
2980
+
2981
+ **stats**(collectionId: string,
2982
+ journeyId: string,
2983
+ body: JourneyStatsRequest = {}) → `Promise<JourneyStatsResponse>`
2984
+ POST /admin/collection/:collectionId/journeys.analytics/:journeyId/stats Computes journey stats over a time window; outcome defaults to 'success'. If `finalStepId` is provided, includes `currentlyActive` and `completed` fields.
2985
+
2986
+ **recipients**(collectionId: string,
2987
+ journeyId: string,
2988
+ stepId: string,
2989
+ body: JourneyStepRecipientsRequest = {}) → `Promise<JourneyStepRecipientsResponse>`
2990
+ POST /admin/collection/:collectionId/journeys.analytics/:journeyId/steps/:stepId/recipients Returns recipient IDs for a given journey step. For completed/pending, `interactionId` is required; outcome defaults to 'success'.
2991
+
2992
+ **funnelReport**(collectionId: string,
2993
+ journeyId: string,
2994
+ body: JourneyFunnelReportRequest) → `Promise<JourneyFunnelReportResponse>`
2995
+ POST /admin/collection/:collectionId/journeys.analytics/:journeyId/funnel-report Computes conversion, counts, and avg time across mapped steps in a period.
2996
+
2997
+ ### location
2998
+
2999
+ **createGlobal**(params: LocationPayload) → `Promise<Location>`
3000
+ Platform: Create a global location (super admin; requires features.adminApps) POST /platform/location
3001
+
3002
+ **create**(collectionId: string, params: LocationPayload) → `Promise<Location>`
3003
+ Admin: Create a collection-scoped location POST /admin/collection/:collectionId/location
3004
+
3005
+ **search**(collectionId: string,
3006
+ query: LocationSearchQuery = {}) → `Promise<LocationSearchResponse>`
3007
+ Admin: Search locations to pick during setup (combines collection + global) GET /admin/collection/:collectionId/location/search
3008
+
3009
+ **getPublic**(locationId: string) → `Promise<Location>`
3010
+ Public: Fetch a global location by ID GET /public/location/:locationId
3011
+
3012
+ **getPublicForCollection**(collectionId: string,
3013
+ locationId: string) → `Promise<Location>`
3014
+ Public: Fetch a location for a collection; returns either a collection-owned or global fallback GET /public/collection/:collectionId/location/:locationId
3015
+
3016
+ ### nfc
3017
+
3018
+ **claimTag**(data: NfcClaimTagRequest) → `Promise<NfcTagInfo>`
3019
+ Claim an NFC tag (public). POST /public/nfc/claimTag
3020
+
3021
+ **validate**(data: NfcValidateRequest) → `Promise<NfcValidateResponse>`
3022
+ Validate an NFC tag payload (public). POST /public/nfc/validate
3023
+
3024
+ **lookupTag**(tagId: string) → `Promise<NfcTagInfo[]>`
3025
+ Lookup a tag by its ID (public). GET /public/nfc/findByTag/:tagId
3026
+
3027
+ ### product
3028
+
3029
+ **get**(collectionId: string,
3030
+ productId: string,
3031
+ admin?: boolean) → `Promise<ProductResponse>`
3032
+ Retrieves a single Product Item by Collection ID and Product ID.
3033
+
3034
+ **list**(collectionId: string,
3035
+ admin?: boolean) → `Promise<ProductResponse[]>`
3036
+ List all Product Items for a Collection.
3037
+
3038
+ **create**(collectionId: string,
3039
+ data: ProductCreateRequest) → `Promise<ProductResponse>`
3040
+ Create a new product for a collection (admin only). The `data` payload follows the same shape as ProductResponse minus `id` and `collectionId`.
3041
+
3042
+ **update**(collectionId: string,
3043
+ productId: string,
3044
+ data: ProductUpdateRequest) → `Promise<ProductResponse>`
3045
+ Update a product for a collection (admin only). The `data` payload is a partial of ProductResponse minus `id` and `collectionId`.
3046
+
3047
+ **remove**(collectionId: string,
3048
+ productId: string) → `Promise<void>`
3049
+ Delete a product for a collection (admin only).
3050
+
3051
+ **getSN**(collectionId: string,
3052
+ productId: string,
3053
+ startIndex: number = 0,
3054
+ count: number = 10) → `Promise<any>`
3055
+ Get serial numbers for a product (admin only).
3056
+
3057
+ **lookupSN**(collectionId: string,
3058
+ productId: string,
3059
+ codeId: string) → `Promise<any>`
3060
+ Look up a serial number by code for a product (admin only).
3061
+
3062
+ ### proof
3063
+
3064
+ **get**(collectionId: string,
3065
+ productId: string,
3066
+ proofId: string,
3067
+ admin?: boolean,
3068
+ include?: string[]) → `Promise<ProofResponse>`
3069
+ Retrieves a single Proof by Collection ID, Product ID, and Proof ID. Both public and admin endpoints now include productId in the path.
3070
+
3071
+ **list**(collectionId: string,
3072
+ include?: string[]) → `Promise<ProofResponse[]>`
3073
+ List all Proofs for a Collection.
3074
+
3075
+ **create**(collectionId: string,
3076
+ productId: string,
3077
+ values: ProofCreateRequest) → `Promise<ProofResponse>`
3078
+ Create a proof for a product (admin only). POST /admin/collection/:collectionId/product/:productId/proof
3079
+
3080
+ **update**(collectionId: string,
3081
+ productId: string,
3082
+ proofId: string,
3083
+ values: ProofUpdateRequest) → `Promise<ProofResponse>`
3084
+ Update a proof for a product (admin only). PUT /admin/collection/:collectionId/product/:productId/proof/:proofId
3085
+
3086
+ **claim**(collectionId: string,
3087
+ productId: string,
3088
+ proofId: string,
3089
+ values: ProofClaimRequest) → `Promise<ProofResponse>`
3090
+ Claim a proof for a product. PUT /public/collection/:collectionId/product/:productId/proof/:proofId
3091
+
3092
+ **remove**(collectionId: string,
3093
+ productId: string,
3094
+ proofId: string) → `Promise<void>`
3095
+ Delete a proof for a product (admin only). DELETE /admin/collection/:collectionId/product/:productId/proof/:proofId
3096
+
3097
+ **getByUser**(collectionId: string,
3098
+ userId: string) → `Promise<ProofResponse[]>`
3099
+ Get proofs for a user in a collection (admin only). GET /admin/collection/:collectionId/proof/findByUser/:userId
3100
+
3101
+ **getByProduct**(collectionId: string,
3102
+ productId: string) → `Promise<ProofResponse[]>`
3103
+ Get proofs for a product (admin only). GET /admin/collection/:collectionId/product/:productId/proof
3104
+
3105
+ **findByProduct**(collectionId: string,
3106
+ productId: string,
3107
+ query: any) → `Promise<ProofResponse[]>`
3108
+ Find proofs for a product (admin only). POST /admin/collection/:collectionId/product/:productId/proof/find
3109
+
3110
+ **getByBatch**(collectionId: string,
3111
+ productId: string,
3112
+ batchId: string) → `Promise<ProofResponse[]>`
3113
+ Get proofs for a batch (admin only). GET /admin/collection/:collectionId/product/:productId/batch/:batchId/proof
3114
+
3115
+ ### qr
3116
+
3117
+ **lookupShortCode**(shortId: string, code: string) → `Promise<QrShortCodeLookupResponse>`
3118
+ Resolve a short code to related resource identifiers.
3119
+
3120
+ ### realtime
3121
+
3122
+ **getPublicToken**(params: RealtimeTokenRequest) → `Promise<AblyTokenRequest>`
3123
+ Get an Ably token for public (user-scoped) real-time communication. This endpoint returns an Ably TokenRequest that can be used to initialize an Ably client with appropriate permissions for the specified collection and optional app. Requires user authentication (Bearer token). ```ts const tokenRequest = await realtime.getPublicToken({ collectionId: 'my-collection-id', appId: 'my-app-id' }) // Use with Ably const ably = new Ably.Realtime.Promise({ authCallback: async (data, callback) => { callback(null, tokenRequest) } }) // Subscribe to channels matching the pattern const channel = ably.channels.get('collection:my-collection-id:app:my-app-id:chat:general') await channel.subscribe('message', (msg) => console.log(msg.data)) ```
3124
+
3125
+ **getAdminToken**() → `Promise<AblyTokenRequest>`
3126
+ Get an Ably token for admin real-time communication. This endpoint returns an Ably TokenRequest that can be used to initialize an Ably client with admin permissions to receive system notifications and alerts. Admin users get subscribe-only (read-only) access to the interaction:{userId} channel pattern. Requires admin authentication (Bearer token). ```ts const tokenRequest = await realtime.getAdminToken() // Use with Ably const ably = new Ably.Realtime.Promise({ authCallback: async (data, callback) => { callback(null, tokenRequest) } }) // Subscribe to admin interaction channel const userId = 'my-user-id' const channel = ably.channels.get(`interaction:${userId}`) await channel.subscribe((message) => { console.log('Admin notification:', message.data) }) ```
3127
+
3128
+ ### segments
3129
+
3130
+ **create**(collectionId: string,
3131
+ body: Omit<SegmentRecord, 'id' | 'collectionId' | 'createdAt'>) → `Promise<SegmentRecord>`
3132
+
3133
+ **list**(collectionId: string,
3134
+ query: ListSegmentsQuery = {}) → `Promise<SegmentList>`
3135
+
3136
+ **get**(collectionId: string,
3137
+ id: string) → `Promise<SegmentRecord>`
3138
+
3139
+ **update**(collectionId: string,
3140
+ id: string,
3141
+ body: Partial<Omit<SegmentRecord, 'id' | 'collectionId' | 'createdAt'>>) → `Promise<SegmentRecord>`
3142
+
3143
+ **remove**(collectionId: string,
3144
+ id: string) → `Promise<void>`
3145
+
3146
+ **calculate**(collectionId: string,
3147
+ id: string) → `Promise<SegmentCalculateResult>`
3148
+
3149
+ **recipients**(collectionId: string,
3150
+ id: string,
3151
+ query: { limit?: number; offset?: number } = {}) → `Promise<SegmentRecipientsResponse>`
3152
+
3153
+ ### template
3154
+
3155
+ **getAll**(collectionId: string) → `Promise<Template[]>`
3156
+
3157
+ **get**(collectionId: string, templateId: string) → `Promise<Template>`
3158
+
3159
+ **create**(collectionId: string, data: TemplateInput) → `Promise<Template>`
3160
+
3161
+ **update**(collectionId: string,
3162
+ templateId: string,
3163
+ data: TemplateUpdate) → `Promise<Template>`
3164
+
3165
+ **del**(collectionId: string, templateId: string) → `Promise<Template>`
3166
+
3167
+ **uploadAsset**(collectionId: string,
3168
+ templateId: string,
3169
+ file: File | Blob) → `Promise<`
3170
+
3171
+ **getAllowed**(collectionId: string) → `Promise<TemplatePublic[]>`
3172
+
3173
+ **getPublic**(collectionId: string, templateId: string) → `Promise<TemplatePublic>`
3174
+
3175
+ **getGlobal**(templateId: string) → `Promise<TemplatePublic>`
3176
+
3177
+ **getAllowedGlobal**(collectionId: string) → `Promise<TemplatePublic[]>`
3178
+
3179
+ **render**(collectionId: string,
3180
+ templateId: string,
3181
+ body: TemplateRenderRequest) → `Promise<TemplateRenderResponse>`
3182
+
3183
+ **renderSource**(collectionId: string,
3184
+ body: TemplateRenderSourceRequest) → `Promise<TemplateRenderSourceResponse>`
3185
+
3186
+ ### variant
3187
+
3188
+ **get**(collectionId: string,
3189
+ productId: string,
3190
+ variantId: string) → `Promise<VariantResponse>`
3191
+ Get a single variant by ID for a collection and product (admin only).
3192
+
3193
+ **list**(collectionId: string,
3194
+ productId: string) → `Promise<VariantResponse[]>`
3195
+ List all variants for a collection and product (admin only).
3196
+
3197
+ **create**(collectionId: string,
3198
+ productId: string,
3199
+ data: VariantCreateRequest) → `Promise<VariantResponse>`
3200
+ Create a new variant for a collection and product (admin only).
3201
+
3202
+ **update**(collectionId: string,
3203
+ productId: string,
3204
+ variantId: string,
3205
+ data: VariantUpdateRequest) → `Promise<VariantResponse>`
3206
+ Update a variant for a collection and product (admin only).
3207
+
3208
+ **remove**(collectionId: string,
3209
+ productId: string,
3210
+ variantId: string) → `Promise<void>`
3211
+ Delete a variant for a collection and product (admin only).
3212
+
3213
+ **getPublic**(collectionId: string,
3214
+ productId: string,
3215
+ variantId: string) → `Promise<VariantResponse>`
3216
+ Get a single variant by ID for a collection and product (public endpoint).
3217
+
3218
+ **getSN**(collectionId: string,
3219
+ productId: string,
3220
+ variantId: string,
3221
+ startIndex: number = 0,
3222
+ count: number = 10) → `Promise<any>`
3223
+ Get serial numbers for a variant (admin only).
3224
+
3225
+ **lookupSN**(collectionId: string,
3226
+ productId: string,
3227
+ variantId: string,
3228
+ codeId: string) → `Promise<any>`
3229
+ Look up a serial number by code for a variant (admin only).
3230
+