@dossier-wiki/os-sdk 0.1.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.d.ts CHANGED
@@ -2,6 +2,195 @@ export interface Paginated<T> {
2
2
  data: T[];
3
3
  pagination: PaginationMeta;
4
4
  }
5
+ /** A resource tag assignment: slugified `value` + snapshotted `label`. */
6
+ export interface TagValue {
7
+ /** Slugified, stable key (catalogue value). */
8
+ value: string;
9
+ /** Human-readable label snapshot at assignment time. */
10
+ label: string;
11
+ }
12
+ /**
13
+ * Tag assignment input. Pass `label` only and the slug `value` is derived
14
+ * server-side, or pass both to pin a specific catalogue value.
15
+ */
16
+ export interface TagValueInput {
17
+ label: string;
18
+ value?: string;
19
+ }
20
+ /** The catalogue-governed tag field-keys. */
21
+ export type TagFieldKey = 'customer.tags' | 'customer.riskTags' | 'counterparty.tags' | 'counterparty.riskTags' | 'alert.dispositionTags' | 'product.tags' | 'address.tags' | 'rule.tags' | 'identificationDocument.tags' | 'customScreeningList.tags' | 'team.tags' | 'channelEndpoint.tags' | 'channelEndpoint.riskTags' | 'institution.riskTags';
22
+ /** How many tags from one group a single record may carry. */
23
+ export type TagGroupCardinality = 'SINGLE' | 'MULTI';
24
+ /**
25
+ * A tag group — the facet ("Occupation", "Primary Branch") that owns a slice of
26
+ * one field-key's vocabulary. Its `value` is the namespace its member tags
27
+ * carry: `primary-branch:kandy`.
28
+ */
29
+ export interface TagGroup {
30
+ id: string;
31
+ fieldKey: TagFieldKey;
32
+ /** Namespace slug. Never contains ':'. */
33
+ value: string;
34
+ label: string;
35
+ description?: string | null;
36
+ color?: string | null;
37
+ cardinality: TagGroupCardinality;
38
+ sortOrder: number;
39
+ archivedAt?: string | null;
40
+ createdAt: string;
41
+ updatedAt: string;
42
+ }
43
+ export interface TagGroupInput {
44
+ fieldKey: TagFieldKey;
45
+ label: string;
46
+ /** Namespace slug. Derived from label when omitted. May not contain ':'. */
47
+ value?: string;
48
+ description?: string;
49
+ color?: string;
50
+ cardinality?: TagGroupCardinality;
51
+ sortOrder?: number;
52
+ }
53
+ /** `fieldKey`/`value` are absent by design — see `regroup` for why. */
54
+ export interface UpdateTagGroupInput {
55
+ label?: string;
56
+ description?: string;
57
+ color?: string;
58
+ /** Tightening to SINGLE is rejected while records hold more than one member tag. */
59
+ cardinality?: TagGroupCardinality;
60
+ sortOrder?: number;
61
+ }
62
+ /** What a regroup did, or (dryRun) exactly what it would do. */
63
+ export interface RegroupReport {
64
+ dryRun: boolean;
65
+ entriesMoved: number;
66
+ assignmentsRewritten: number;
67
+ rulesRewritten: number;
68
+ assignmentPoliciesRewritten: number;
69
+ moves: {
70
+ label: string;
71
+ from: string;
72
+ to: string;
73
+ }[];
74
+ }
75
+ export interface TagCatalogueEntry {
76
+ id: string;
77
+ fieldKey: TagFieldKey;
78
+ /** Namespaced (`primary-branch:kandy`) when the entry belongs to a group. */
79
+ value: string;
80
+ label: string;
81
+ /** Owning group id, or null when ungrouped. */
82
+ groupId?: string | null;
83
+ /** Namespace prefix of `value` — the owning group's slug, or null. */
84
+ groupValue?: string | null;
85
+ color?: string | null;
86
+ description?: string | null;
87
+ archivedAt?: string | null;
88
+ createdAt: string;
89
+ updatedAt: string;
90
+ }
91
+ export interface TagCatalogueEntryInput {
92
+ fieldKey: TagFieldKey;
93
+ label: string;
94
+ /** Unqualified slug. May not contain ':' — join a group via `groupId`. */
95
+ value?: string;
96
+ /** Owning group. The server composes the namespaced stored value. */
97
+ groupId?: string;
98
+ color?: string;
99
+ description?: string;
100
+ }
101
+ export interface UpdateTagCatalogueEntryInput {
102
+ label?: string;
103
+ color?: string;
104
+ description?: string;
105
+ }
106
+ export type TypedFieldType = 'TEXT' | 'NUMBER' | 'BOOLEAN' | 'DATE' | 'LIST' | 'SINGLE_SELECT' | 'MULTI_SELECT'
107
+ /** @deprecated Use LIST, SINGLE_SELECT, or MULTI_SELECT. */
108
+ | 'SET' | 'CURRENCY' | 'MONETARY';
109
+ /** Schema declaration carried on a parent resource (e.g. `Product.accountFieldConfig`). */
110
+ export interface TypedFieldDefinition {
111
+ key: string;
112
+ displayName: string;
113
+ type: TypedFieldType;
114
+ /** Required closed vocabulary for SINGLE_SELECT and MULTI_SELECT. */
115
+ options?: string[] | null;
116
+ required: boolean;
117
+ /** Default applied at write time when the caller omits the key. Raw value, validated against `type`. */
118
+ defaultValue?: unknown;
119
+ description?: string | null;
120
+ }
121
+ /**
122
+ * Caller-facing input for one typed key/value entry. `type` tells the
123
+ * backend validator how to interpret `value`:
124
+ * - TEXT / DATE / CURRENCY → string
125
+ * - NUMBER → finite JS number
126
+ * - BOOLEAN → boolean
127
+ * - LIST / MULTI_SELECT / legacy SET → string[]
128
+ * - SINGLE_SELECT → one string from the definition's options
129
+ * - MONETARY → denominated literal `"<amount>@<TYPE:CODE>"`, e.g. `"50000.00@FIAT:USD"`
130
+ */
131
+ export interface TypedFieldValueInput {
132
+ key: string;
133
+ type: TypedFieldType;
134
+ value: unknown;
135
+ }
136
+ /** Untyped escape-hatch input (Tier C). Stored verbatim. */
137
+ export interface UntypedKeyValueInput {
138
+ key: string;
139
+ value: unknown;
140
+ }
141
+ /**
142
+ * Read shape for one typed key/value entry. Wire-format `type` strings use
143
+ * the lowercase form. Monetary carries pre-resolved minor units.
144
+ */
145
+ export type TypedFieldStored = {
146
+ key: string;
147
+ type: 'text';
148
+ value: string;
149
+ } | {
150
+ key: string;
151
+ type: 'number';
152
+ value: number;
153
+ } | {
154
+ key: string;
155
+ type: 'boolean';
156
+ value: boolean;
157
+ } | {
158
+ key: string;
159
+ type: 'date';
160
+ value: string;
161
+ } | {
162
+ key: string;
163
+ type: 'list';
164
+ value: string[];
165
+ } | {
166
+ key: string;
167
+ type: 'single_select';
168
+ value: string;
169
+ } | {
170
+ key: string;
171
+ type: 'multi_select';
172
+ value: string[];
173
+ }
174
+ /** @deprecated Legacy open list. */
175
+ | {
176
+ key: string;
177
+ type: 'set';
178
+ value: string[];
179
+ } | {
180
+ key: string;
181
+ type: 'currency';
182
+ value: string;
183
+ } | {
184
+ key: string;
185
+ type: 'monetary';
186
+ amountMinor: number;
187
+ currency: string;
188
+ precision: number;
189
+ };
190
+ export interface UntypedKeyValueDto {
191
+ key: string;
192
+ value: unknown;
193
+ }
5
194
  export interface AccountResponseDto {
6
195
  id: string;
7
196
  externalId?: string;
@@ -9,14 +198,14 @@ export interface AccountResponseDto {
9
198
  productId?: string;
10
199
  label: string;
11
200
  accountCategory: 'DEPOSIT' | 'CREDIT' | 'LOAN' | 'WALLET' | 'SECURITIES' | 'OTHER';
201
+ /** @deprecated Retained for API compatibility. Prefer product tags for classification. */
12
202
  accountType: 'CHECKING' | 'SAVINGS' | 'OPERATING' | 'TRUST' | 'INVESTMENT' | 'ESCROW' | 'CREDIT_CARD' | 'LINE_OF_CREDIT' | 'PERSONAL_LOAN' | 'MORTGAGE' | 'AUTO_LOAN' | 'BUSINESS_LOAN' | 'CRYPTO_WALLET' | 'MOBILE_WALLET' | 'PREPAID_CARD' | 'E_WALLET' | 'BROKERAGE' | 'FUND' | 'OTHER';
13
- status: 'ACTIVE' | 'FROZEN' | 'CLOSED' | 'DORMANT';
203
+ status: 'PENDING' | 'ACTIVE' | 'FROZEN' | 'CLOSED' | 'DORMANT';
14
204
  currency?: string;
15
- bankName?: string;
16
- bankSwift?: string;
17
- iban?: string;
18
- accountNumber?: string;
19
- customProperties?: Record<string, unknown>;
205
+ /** Typed Field bag (Tier A). Validated against `Product.typedAccountFieldConfig`. */
206
+ fields?: TypedFieldStored[];
207
+ /** Untyped escape hatch (Tier C). */
208
+ otherProperties?: UntypedKeyValueDto[];
20
209
  openedAt: string;
21
210
  closedAt?: string;
22
211
  }
@@ -39,8 +228,32 @@ export type AddressCategory = 'HOME' | 'MAILING' | 'BILLING' | 'WORK' | 'REGISTE
39
228
  export type Iso20022AddressType = 'BIZZ' | 'DLVY' | 'HOME' | 'MLTO' | 'PBOX' | 'ADDR';
40
229
  export type AddressVerificationStatus = 'PENDING' | 'VERIFIED' | 'REJECTED' | 'EXPIRED';
41
230
  export type Lifecycle = 'LIVE' | 'ARCHIVED' | 'TOMBSTONED';
231
+ /**
232
+ * A geographic point — the platform's one coordinate shape.
233
+ *
234
+ * A latitude without its longitude is not half a location. Everywhere the API
235
+ * carries a point it carries this: one value, one field.
236
+ */
237
+ export interface CoordinatesDto {
238
+ latitude: number;
239
+ longitude: number;
240
+ /** @deprecated The original spelling. Same number as `latitude`. */
241
+ lat?: number;
242
+ /** @deprecated The original spelling. Same number as `longitude`. */
243
+ lng?: number;
244
+ }
42
245
  export interface AddressCoordinatesDto {
246
+ /**
247
+ * The point.
248
+ *
249
+ * On a write this is the only accepted shape — a caller cannot send half a
250
+ * coordinate. On a read, `lat`/`lng` are still returned alongside it for
251
+ * consumers written against the original spelling.
252
+ */
253
+ point?: CoordinatesDto;
254
+ /** @deprecated Read-only. Use `point.latitude`. */
43
255
  lat?: number;
256
+ /** @deprecated Read-only. Use `point.longitude`. */
44
257
  lng?: number;
45
258
  /** Provenance, e.g. 'manual', 'google.geocode'. */
46
259
  source?: string;
@@ -50,8 +263,7 @@ export interface AddressCoordinatesDto {
50
263
  /**
51
264
  * Operational postal address. Lives in the polymorphic `addresses` table on the
52
265
  * server (owner = CUSTOMER / COUNTERPARTY / INSTITUTION). Exposed on the Customer
53
- * subtypes as `Individual.addresses` and `Entity.locations` — same shape, different
54
- * semantic field name.
266
+ * subtypes as `Individual.addresses` and `Entity.addresses` — same shape.
55
267
  *
56
268
  * Categories (semantic) and `iso20022Type` (wire-protocol) are parallel
57
269
  * discriminators; customer rows use `category`, counterparty/institution rows
@@ -67,7 +279,7 @@ export interface AddressDto {
67
279
  ownerResourceId: string;
68
280
  category?: AddressCategory | null;
69
281
  iso20022Type?: Iso20022AddressType | null;
70
- tags: string[];
282
+ tags: TagValue[];
71
283
  note?: string | null;
72
284
  line1?: string | null;
73
285
  line2?: string | null;
@@ -106,7 +318,7 @@ export interface AddressDto {
106
318
  export interface AddressInputDto {
107
319
  category?: AddressCategory;
108
320
  iso20022Type?: Iso20022AddressType;
109
- tags?: string[];
321
+ tags?: TagValueInput[];
110
322
  note?: string;
111
323
  line1?: string;
112
324
  line2?: string;
@@ -201,10 +413,30 @@ export interface CashDetailsDto {
201
413
  export interface ChannelDto {
202
414
  /** Channel type (WEB, MOBILE_APP, BRANCH, ATM, POS, API). */
203
415
  type: string;
416
+ /** Stable identifier for the concrete endpoint, such as a POS terminal, ATM, API client, or web page. */
417
+ identifier?: string;
418
+ /** Integration/provider namespace. Identical identifiers from different providers resolve independently. */
419
+ provider?: string;
420
+ /** Human-readable endpoint name used when it is first observed. */
421
+ displayName?: string;
204
422
  /** Session identifier. */
205
423
  sessionId?: string;
206
424
  /** Embedded session events (auth, copy-paste, form-fill, etc.). */
207
425
  events?: ChannelEventDto[];
426
+ /** Physical endpoint location, distinct from the device location. */
427
+ physicalLocation?: LocationObservationDto;
428
+ /** Bounded integration-defined values. Credential-like keys are rejected by the API. */
429
+ context?: Record<string, string | number | boolean | null>;
430
+ }
431
+ export interface LocationObservationDto {
432
+ latitude: number;
433
+ longitude: number;
434
+ accuracyMeters?: number;
435
+ confidence?: number;
436
+ source?: string;
437
+ method?: string;
438
+ isEstimated?: boolean;
439
+ observedAt?: string;
208
440
  }
209
441
  export interface ChannelEventDto {
210
442
  /** Event type (e.g. session.auth, session.copy_paste). */
@@ -302,7 +534,8 @@ export interface CounterpartyResponseDto {
302
534
  identity: 'INDIVIDUAL' | 'ENTITY' | 'UNKNOWN';
303
535
  classification: 'BANK_ACCOUNT' | 'WALLET' | 'MERCHANT' | 'FINANCIAL_INSTITUTION' | 'PAYMENT_NETWORK' | 'UNKNOWN';
304
536
  country?: string;
305
- riskLevel: 'HIGH' | 'MEDIUM' | 'LOW' | 'UNRATED';
537
+ /** Unified risk rating; null = unrated (was `riskLevel` with UNRATED). */
538
+ riskRating: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL' | null;
306
539
  source: 'MANUAL' | 'SYSTEM';
307
540
  linkedCustomerIds: string[];
308
541
  /** ID of the transaction that first created this counterparty */
@@ -313,25 +546,35 @@ export interface CounterpartyResponseDto {
313
546
  institution?: InstitutionDetailsDto;
314
547
  firstTransactionAt?: string;
315
548
  lastTransactionAt?: string;
549
+ /** Untyped escape hatch (Tier C). */
550
+ otherProperties?: UntypedKeyValueDto[];
316
551
  createdAt: string;
317
552
  updatedAt: string;
318
553
  }
319
554
  export interface CreateAccountDto {
320
- /** Your external identifier */
555
+ /**
556
+ * Customer to register as the PRIMARY owner. Written into
557
+ * `account_owners`, not stored on the accounts row (D18).
558
+ */
559
+ primaryCustomerId: string;
560
+ /** Your external identifier. Defaults to `ACC-${timestamp}`. */
321
561
  externalId?: string;
322
- /** Product ID this account is based on */
562
+ /**
563
+ * Product this account is instantiated from. Determines `accountCategory`
564
+ * and the required typed-field schema. The deprecated `accountType`
565
+ * compatibility field is still derived from the product and is not
566
+ * accepted from the caller.
567
+ */
323
568
  productId?: string;
324
569
  label: string;
325
- accountCategory: 'DEPOSIT' | 'CREDIT' | 'LOAN' | 'WALLET' | 'SECURITIES' | 'OTHER';
326
- accountType: 'CHECKING' | 'SAVINGS' | 'OPERATING' | 'TRUST' | 'INVESTMENT' | 'ESCROW' | 'CREDIT_CARD' | 'LINE_OF_CREDIT' | 'PERSONAL_LOAN' | 'MORTGAGE' | 'AUTO_LOAN' | 'BUSINESS_LOAN' | 'CRYPTO_WALLET' | 'MOBILE_WALLET' | 'PREPAID_CARD' | 'E_WALLET' | 'BROKERAGE' | 'FUND' | 'OTHER';
327
- /** Currency code (ISO 4217) */
570
+ /** Currency code (ISO 4217 / `TYPE:CODE`). Falls back to `product.defaultCurrency`. */
328
571
  currency?: string;
329
- bankName?: string;
330
- bankSwift?: string;
331
- iban?: string;
332
- accountNumber?: string;
333
- /** Arbitrary key-value properties */
334
- customProperties?: Record<string, unknown>;
572
+ /** Typed Field write input (Tier A). Validated against `Product.typedAccountFieldConfig`. */
573
+ fields?: TypedFieldValueInput[];
574
+ /** Untyped escape hatch (Tier C). Stored verbatim. */
575
+ otherProperties?: UntypedKeyValueInput[];
576
+ /** Customer IDs to add as JOINT owners alongside the primary. */
577
+ additionalOwnerIds?: string[];
335
578
  /** Override account opening timestamp (ISO 8601). Used by data-loading tools to backfill historical accounts. */
336
579
  openedAt?: string;
337
580
  }
@@ -342,16 +585,14 @@ export interface CreateApiKeyDto {
342
585
  scope: 'full_access' | 'evaluate_only';
343
586
  /** Expiration in seconds (default: 1 year) */
344
587
  expiresInSeconds?: number;
345
- /** Organization ID to scope this key to (defaults to active org) */
346
- organizationId?: string;
347
588
  }
348
589
  export interface CreateConstantDto {
349
590
  /** Constant name (e.g. $global.highRiskCountries). */
350
591
  name: string;
351
592
  /** Scope (derived from name if omitted). */
352
- scope?: 'global' | 'product' | 'customer' | 'account' | 'counterparty' | 'instrument' | 'device';
593
+ scope?: 'global' | 'product' | 'customer' | 'account' | 'counterparty' | 'paymentInstrument' | 'device';
353
594
  /** Constant type. Determines the required shape of `value`. */
354
- type: 'scalar' | 'monetary' | 'set' | 'range' | 'text' | 'number' | 'boolean' | 'date' | 'currency';
595
+ type: 'scalar' | 'monetary' | 'set' | 'range' | 'text' | 'number' | 'boolean' | 'date' | 'currency' | 'regex';
355
596
  /** Payload shape depends on the constant's `type`. Pick the matching variant below. Validated at write time. */
356
597
  value: {
357
598
  /** e.g. `"1000000@FIAT:USD"` = $10,000.00. Precision implied by currency: USD=2, JPY=0, BTC=8, ETH=9, USDT/USDC=6. */
@@ -368,6 +609,65 @@ export interface CreateConstantDto {
368
609
  description?: string;
369
610
  /** Sync key for config-as-code management. */
370
611
  syncKey?: string;
612
+ /** Product id for a product-bound `$account.*` definition. */
613
+ productId?: string;
614
+ }
615
+ export type StateScope = 'customer' | 'account' | 'counterparty' | 'product' | 'paymentInstrument' | 'device';
616
+ export type StateResourceType = 'CUSTOMER' | 'ACCOUNT' | 'COUNTERPARTY' | 'PRODUCT' | 'PAYMENT_INSTRUMENT' | 'DEVICE';
617
+ export type StateType = 'text' | 'number' | 'boolean' | 'date' | 'currency' | 'monetary' | 'set';
618
+ export type StateOperation = 'SET' | 'INCREMENT' | 'DECREMENT';
619
+ export interface CreateStateDefinitionInput {
620
+ name: string;
621
+ scope: StateScope;
622
+ type: StateType;
623
+ initialValue?: unknown;
624
+ description?: string;
625
+ /** Only valid for account-scoped definitions. */
626
+ productId?: string;
627
+ }
628
+ export interface StateDefinitionDto extends Omit<CreateStateDefinitionInput, 'productId'> {
629
+ id: string;
630
+ productId: string | null;
631
+ createdAt: string;
632
+ updatedAt: string;
633
+ }
634
+ export interface ChangeResourceStateInput {
635
+ resourceType: StateResourceType;
636
+ resourceId: string;
637
+ name: string;
638
+ operation: StateOperation;
639
+ /** Replacement value for SET; magnitude for INCREMENT or DECREMENT. */
640
+ value: unknown;
641
+ reason?: string;
642
+ }
643
+ export interface ResourceStateDto {
644
+ id: string;
645
+ resourceType: StateResourceType;
646
+ resourceId: string;
647
+ name: string;
648
+ type: StateType;
649
+ value: unknown;
650
+ updatedByActorType: string;
651
+ updatedByActorId: string;
652
+ reason: string | null;
653
+ createdAt: string;
654
+ updatedAt: string;
655
+ }
656
+ export interface ResourceStateHistoryDto {
657
+ id: string;
658
+ resourceStateId: string;
659
+ resourceType: StateResourceType;
660
+ resourceId: string;
661
+ name: string;
662
+ type: StateType;
663
+ operation: StateOperation;
664
+ operand: unknown | null;
665
+ previousValue: unknown | null;
666
+ newValue: unknown;
667
+ actorType: string;
668
+ actorId: string;
669
+ reason: string | null;
670
+ changedAt: string;
371
671
  }
372
672
  export interface CreateCounterpartyDto {
373
673
  externalId?: string;
@@ -377,33 +677,152 @@ export interface CreateCounterpartyDto {
377
677
  classification: 'BANK_ACCOUNT' | 'WALLET' | 'MERCHANT' | 'FINANCIAL_INSTITUTION' | 'PAYMENT_NETWORK' | 'UNKNOWN';
378
678
  /** ISO 3166-1 alpha-3 country code */
379
679
  country?: string;
680
+ /**
681
+ * Catalogue-governed tags (e.g. operating branch), stamped at creation so
682
+ * the INITIAL screening run — and any assignment-policy tag routing —
683
+ * sees them. Values not in the catalogue are rejected.
684
+ */
685
+ tags?: TagValueInput[];
380
686
  bankAccount?: BankAccountDetailsDto;
381
687
  wallet?: CryptoWalletDetailsDto;
382
688
  merchant?: MerchantDetailsDto;
383
689
  institution?: InstitutionDetailsDto;
384
690
  }
385
- /** OpenAPI schema is empty; treated as an opaque key/value bag — narrow on the caller side. */
386
- export type CreateCurrencyInput = Record<string, unknown>;
387
- export interface CreateEntityDto {
691
+ /** Currency classification. Mirrors the backend `CurrencyType` enum. */
692
+ export type CurrencyType = 'FIAT' | 'CRYPTO' | 'OTHER';
693
+ /** Product/account category. Mirrors the backend `AccountCategory` enum. */
694
+ export type AccountCategory = 'DEPOSIT' | 'CREDIT' | 'LOAN' | 'WALLET' | 'SECURITIES' | 'OTHER';
695
+ /** Base account type. Mirrors the backend `AccountType` enum. */
696
+ export type AccountType = 'CHECKING' | 'SAVINGS' | 'OPERATING' | 'TRUST' | 'INVESTMENT' | 'ESCROW' | 'CREDIT_CARD' | 'LINE_OF_CREDIT' | 'PERSONAL_LOAN' | 'MORTGAGE' | 'AUTO_LOAN' | 'BUSINESS_LOAN' | 'CRYPTO_WALLET' | 'MOBILE_WALLET' | 'PREPAID_CARD' | 'E_WALLET' | 'BROKERAGE' | 'FUND' | 'OTHER';
697
+ /** Product lifecycle status. Mirrors the backend `ProductStatus` enum. */
698
+ export type ProductStatus = 'ACTIVE' | 'DISCONTINUED';
699
+ export interface CreateCurrencyInput {
700
+ type: CurrencyType;
701
+ code: string;
702
+ /** Number of minor-unit decimal places (0–18). */
703
+ precision: number;
704
+ name: string;
705
+ symbol?: string;
706
+ }
707
+ export interface ContactEntryInput {
708
+ value: string;
709
+ primary: boolean;
710
+ }
711
+ /** Identification document embedded in an individual-create request. */
712
+ export interface InlineIdentificationDocumentInput {
713
+ id?: string;
714
+ type: string;
715
+ number: string;
716
+ /** ISO 3166-1 alpha-3 country code. */
717
+ country: string;
718
+ /** @deprecated Alias for `country`, honoured only when `country` is absent. */
719
+ issuingCountry?: string;
720
+ expiryDate?: string;
721
+ dateOfIssue?: string;
722
+ fullNameEn?: string;
723
+ transliterationNames?: string[];
724
+ addresses?: RichAddressInputDto[];
725
+ dateOfBirth?: string;
726
+ sex?: string;
727
+ other?: Record<string, unknown>;
728
+ notes?: string;
729
+ attachments?: IdDocFileAttachmentInput[];
730
+ /** @deprecated Use `attachments` instead. */
731
+ fileIds?: string[];
732
+ }
733
+ /** Canonical REST/GraphQL entity-create request. */
734
+ export interface CreateEntityInput {
388
735
  /** Your external identifier for this entity. Must be unique within the organization. */
389
736
  externalId: string;
390
737
  legalName: string;
738
+ status?: CustomerStatus;
391
739
  tradingNames?: string[];
392
740
  registrationNumber?: string;
741
+ /** Tax Identification Number (TIN). */
742
+ taxId?: string;
393
743
  /** ISO 3166-1 alpha-3 country code */
394
744
  countryOfIncorporation?: string;
395
745
  dateOfIncorporation?: string;
396
746
  entityType?: string;
397
- /** Parent entity ID for subsidiaries */
398
- parentEntityId?: string;
399
- email?: string;
400
- phone?: string;
747
+ websites?: string[];
748
+ stakeholders?: StakeholderInput[];
401
749
  /** Inline fan-out into the polymorphic `addresses` table. Same shape as
402
- * Individual.addresses; field is named `locations` to match the read-side
403
- * GraphQL field for entities. */
750
+ * Individual.addresses; named `locations` on entities. */
404
751
  locations?: AddressInputDto[];
405
- /** Override creation timestamp (ISO 8601). Used by data-loading tools to backfill historical entities. */
752
+ /**
753
+ * Catalogue-governed tags (e.g. operating branch), stamped at creation so
754
+ * the INITIAL screening run — and any assignment-policy tag routing —
755
+ * sees them. Values not in the catalogue are rejected.
756
+ */
757
+ tags?: TagValueInput[];
758
+ /**
759
+ * Standing assignment (user ids), stamped at creation so INITIAL screening
760
+ * and CUSTOMER_ASSIGNEE routing see it. Post-create edits via
761
+ * `customers.assignment.assign`.
762
+ */
763
+ assignedToUserIds?: string[];
764
+ /**
765
+ * Standing assignment (team ids), stamped at creation so INITIAL screening
766
+ * and CUSTOMER_ASSIGNEE routing see it. Post-create edits via
767
+ * `customers.assignment.assign`.
768
+ */
769
+ assignedToTeamIds?: string[];
770
+ /** @deprecated Use `emails`. Honoured only when `emails` is absent. */
771
+ email?: string;
772
+ /** @deprecated Use `phones`. Honoured only when `phones` is absent. */
773
+ phone?: string;
774
+ /** Override the creation timestamp (ISO 8601). For data-loading tools backfilling historical records. */
406
775
  createdAt?: string;
776
+ /** @deprecated Alias for `locations`, honoured only when `locations` is absent. */
777
+ addresses?: AddressInputDto[];
778
+ /** Parent entity for subsidiaries. */
779
+ parentEntityId?: string;
780
+ }
781
+ /** @deprecated Use `CreateEntityInput`. */
782
+ export type CreateEntityDto = CreateEntityInput;
783
+ /**
784
+ * A Risk Signal to emit on every valid occurrence of an event.
785
+ *
786
+ * Tenant configuration: an integration pushing an event cannot add, change, or
787
+ * suppress an effect. `weight` and `halfLife` are snapshotted onto each emitted
788
+ * signal, so editing the definition later never rewrites signals already
789
+ * recorded.
790
+ */
791
+ export interface RiskSignalEffect {
792
+ /** Dotted signal type to emit, e.g. `authentication.password_change_attempt`. */
793
+ type: string;
794
+ /** Strength at the event timestamp. Must be greater than zero. */
795
+ weight: number;
796
+ /**
797
+ * Positive ISO 8601 duration, e.g. `P3D`. Calendar units (Y/M) are
798
+ * rejected — they have no fixed length.
799
+ */
800
+ halfLife: string;
801
+ /**
802
+ * Defaults to `EVENT_RESOURCE` — the signal attaches to the event's own
803
+ * primary resource.
804
+ */
805
+ target?: 'EVENT_RESOURCE';
806
+ }
807
+ /** What a declared resource is to the event. */
808
+ export type EventResourceRole = 'SUBJECT' | 'CONTEXT';
809
+ /** Every resource an Event Definition can name, in either role. */
810
+ export type EventDeclaredResource = 'CUSTOMER' | 'ACCOUNT' | 'COUNTERPARTY' | 'EMPLOYEE' | 'BRANCH' | 'PAYMENT_INSTRUMENT' | 'DEVICE' | 'SESSION' | 'TRANSACTION';
811
+ /**
812
+ * One resource an Event Definition names.
813
+ *
814
+ * `SUBJECT` entries enumerate the kinds an occurrence may be *about*; an
815
+ * occurrence names exactly one, so `required` carries no meaning there and the
816
+ * API normalises it to true. `CONTEXT` entries are the further resources it
817
+ * references, where `required` decides whether ingestion accepts an occurrence
818
+ * without one.
819
+ *
820
+ * `DEVICE`, `SESSION` and `TRANSACTION` are declarable as `CONTEXT` only.
821
+ */
822
+ export interface EventResourceDeclarationDto {
823
+ resource: EventDeclaredResource;
824
+ role: EventResourceRole;
825
+ required: boolean;
407
826
  }
408
827
  export interface CreateEventDefinitionDto {
409
828
  /** Unique event name (used as key). */
@@ -414,29 +833,67 @@ export interface CreateEventDefinitionDto {
414
833
  description?: string;
415
834
  /** Event category. */
416
835
  category?: string;
417
- /** Event properties schema. */
418
- properties?: Record<string, unknown>[];
836
+ /**
837
+ * Resources this event names, each as SUBJECT (what an occurrence is
838
+ * about) or CONTEXT (what it also references). Omit to accept any
839
+ * attachable subject and expect no context.
840
+ */
841
+ resources?: EventResourceDeclarationDto[];
842
+ /** Event property schema. Same shape as `TypedFieldDefinition` (including `options` for select types). */
843
+ properties?: TypedFieldDefinition[];
844
+ /** Risk Signals to emit on every valid occurrence of this event. */
845
+ riskSignalEffects?: RiskSignalEffect[];
419
846
  /** Sync key for config-as-code management. */
420
847
  syncKey?: string;
421
848
  }
422
- export interface CreateIndividualDto {
849
+ /** Canonical REST/GraphQL individual-create request. */
850
+ export interface CreateIndividualInput {
423
851
  /** Your external identifier for this customer. Must be unique within the organization. */
424
852
  externalId: string;
425
853
  fullName: string;
854
+ status?: CustomerStatus;
426
855
  preferredName?: string;
856
+ aliases?: string[];
427
857
  dateOfBirth?: string;
428
858
  /** ISO 3166-1 alpha-3 country codes */
429
859
  nationality?: string[];
430
860
  /** ISO 3166-1 alpha-3 country codes */
431
861
  countryOfResidence?: string[];
432
- email?: string;
433
- phone?: string;
434
- identificationDocuments?: IdentificationDocumentDto[];
862
+ /** Tax Identification Number (TIN). */
863
+ taxId?: string;
864
+ emails?: ContactEntryInput[];
865
+ phones?: ContactEntryInput[];
866
+ identificationDocuments?: InlineIdentificationDocumentInput[];
867
+ faceImageFileIds?: string[];
435
868
  /** Inline fan-out into the polymorphic `addresses` table. */
436
869
  addresses?: AddressInputDto[];
437
- /** Override creation timestamp (ISO 8601). Used by data-loading tools to backfill historical customers. */
870
+ /**
871
+ * Catalogue-governed tags (e.g. operating branch), stamped at creation so
872
+ * the INITIAL screening run — and any assignment-policy tag routing —
873
+ * sees them. Values not in the catalogue are rejected.
874
+ */
875
+ tags?: TagValueInput[];
876
+ /**
877
+ * Standing assignment (user ids), stamped at creation so INITIAL screening
878
+ * and CUSTOMER_ASSIGNEE routing see it. Post-create edits via
879
+ * `customers.assignment.assign`.
880
+ */
881
+ assignedToUserIds?: string[];
882
+ /**
883
+ * Standing assignment (team ids), stamped at creation so INITIAL screening
884
+ * and CUSTOMER_ASSIGNEE routing see it. Post-create edits via
885
+ * `customers.assignment.assign`.
886
+ */
887
+ assignedToTeamIds?: string[];
888
+ /** @deprecated Use `emails`. Honoured only when `emails` is absent. */
889
+ email?: string;
890
+ /** @deprecated Use `phones`. Honoured only when `phones` is absent. */
891
+ phone?: string;
892
+ /** Override the creation timestamp (ISO 8601). For data-loading tools backfilling historical records. */
438
893
  createdAt?: string;
439
894
  }
895
+ /** @deprecated Use `CreateIndividualInput`. */
896
+ export type CreateIndividualDto = CreateIndividualInput;
440
897
  export interface CreateNoteDto {
441
898
  /** Note text content */
442
899
  text: string;
@@ -449,59 +906,146 @@ export interface CreateProductDto {
449
906
  /** Product description. */
450
907
  description?: string;
451
908
  /** Account category. */
452
- category: string;
453
- /** Base account type. */
454
- baseType: string;
909
+ category: AccountCategory;
910
+ /** Preferred product classification, governed by the `product.tags` catalogue. */
911
+ tags?: TagValueInput[];
912
+ /** @deprecated Use `tags`. Omitted values are stored as `OTHER`. */
913
+ baseType?: AccountType;
455
914
  /** Default currency in TYPE:CODE format. */
456
915
  defaultCurrency: string;
457
- /** ISO 3166-1 alpha-3 country code. */
916
+ /** @deprecated Use `tags` when product classification is needed. */
458
917
  country?: string;
459
918
  /** Supported transaction method IDs. */
460
919
  supportedMethodIds: string[];
461
- /** Arbitrary product metadata. */
462
- metadata?: Record<string, unknown>;
920
+ /** Account field template for accounts created from this product. */
921
+ accountFieldConfig?: TypedFieldDefinition[];
922
+ /** @deprecated Use `accountFieldConfig`. */
923
+ typedAccountFieldConfig?: TypedFieldDefinition[];
924
+ /** Product-level typed bag (Tier B, self-declaring). */
925
+ fields?: TypedFieldValueInput[];
926
+ /** Untyped escape hatch (Tier C). */
927
+ otherProperties?: UntypedKeyValueInput[];
463
928
  /** Sync key for config-as-code management. */
464
929
  syncKey?: string;
465
930
  }
931
+ /** Attachment metadata for a file already uploaded via the file-upload flow. */
932
+ export interface RiskAssessmentFileDto {
933
+ /** Uploaded file id (customer file id, or fileKey for platform uploads) */
934
+ id: string;
935
+ name: string;
936
+ /** File size in bytes */
937
+ size: number;
938
+ }
466
939
  export interface CreateRiskAssessmentDto {
467
940
  answers: RiskAssessmentAnswerDto[];
468
- resultingRiskLevel: 'HIGH' | 'MEDIUM' | 'LOW' | 'UNRATED';
469
- computedRiskLevel?: 'HIGH' | 'MEDIUM' | 'LOW' | 'UNRATED';
941
+ resultingRiskRating: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
942
+ computedRiskRating?: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
470
943
  ratingOverridden?: boolean;
471
944
  overrideJustification?: string;
472
945
  narrative?: string;
473
- riskTags?: string[];
946
+ riskTags?: TagValueInput[];
947
+ files?: RiskAssessmentFileDto[];
474
948
  }
475
- export interface CreateRiskQuestionnaireDto {
476
- answers: RiskQuestionnaireAnswerDto[];
949
+ export interface CreateCustomerRiskAssessmentDto {
950
+ answers: CustomerRiskAssessmentAnswerDto[];
477
951
  /** Optional narrative summary */
478
952
  narrative?: string;
953
+ files?: RiskAssessmentFileDto[];
954
+ }
955
+ /**
956
+ * One action executed when a rule fires (spec v0 rules §8).
957
+ * `CREATE_ALERT` accepts an optional `severity` override
958
+ * (CRITICAL/HIGH/MEDIUM/LOW) plus `assignToTeamIds` / `assignToUserIds`;
959
+ * `SEND_WEBHOOK` references a configured webhook destination by `webhookId`;
960
+ * `FLAG_ENTITY` requires `entityType` + `flagType`; `TAG_CUSTOMER` requires
961
+ * `tag`; `ESCALATE` accepts an optional raising `severity` (HIGH/CRITICAL);
962
+ * `ADD_RISK_SIGNAL` requires `signalType`, `weight`, `halfLife` and `target`.
963
+ * Non-webhook types may appear at most once per rule — duplicates are
964
+ * rejected with 400. `ADD_RISK_SIGNAL` is exempt (one rule may legitimately
965
+ * record several kinds of evidence, or the same evidence against several
966
+ * resources); what it rejects is the same `signalType` on the same
967
+ * `target.resource` twice, which would double-count in every aggregate.
968
+ */
969
+ export interface RuleAction {
970
+ type: 'CREATE_ALERT' | 'SEND_WEBHOOK' | 'FLAG_ENTITY' | 'TAG_CUSTOMER' | 'BLOCK_TRANSACTION' | 'FREEZE_ACCOUNT' | 'ADD_RISK_SIGNAL' | 'ASSIGN_FOR_REVIEW' | 'ESCALATE';
971
+ /** CREATE_ALERT: alert risk level override (defaults to the rule
972
+ * severity). ESCALATE: HIGH or CRITICAL only. */
973
+ severity?: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW';
974
+ /** CREATE_ALERT: better-auth team ids assigned to the alert on creation. */
975
+ assignToTeamIds?: string[];
976
+ /** CREATE_ALERT: user ids assigned to the alert on creation. */
977
+ assignToUserIds?: string[];
978
+ /** SEND_WEBHOOK: configured webhook destination id. */
979
+ webhookId?: string;
980
+ /** FLAG_ENTITY: which entity the flag lands on (required). */
981
+ entityType?: 'TRANSACTION' | 'CUSTOMER' | 'ACCOUNT';
982
+ /** FLAG_ENTITY: tenant-meaningful flag label, e.g. REVIEW_REQUIRED (required). */
983
+ flagType?: string;
984
+ /** TAG_CUSTOMER: tag appended to the customer record (required). */
985
+ tag?: string;
986
+ /**
987
+ * ADD_RISK_SIGNAL: dotted signal type to record (required). Tenant
988
+ * vocabulary — not a fixed platform enum.
989
+ */
990
+ signalType?: string;
991
+ /**
992
+ * ADD_RISK_SIGNAL: strength at the moment the rule fires (required, > 0).
993
+ * Snapshotted onto every signal the action emits.
994
+ */
995
+ weight?: number;
996
+ /**
997
+ * ADD_RISK_SIGNAL: positive ISO 8601 duration (required), e.g. `P7D`.
998
+ * Calendar units (Y/M) are rejected — they have no fixed length.
999
+ */
1000
+ halfLife?: string;
1001
+ /**
1002
+ * ADD_RISK_SIGNAL: which resource in the evaluation the signal attaches to
1003
+ * (required). A closed selector, never a field expression.
1004
+ *
1005
+ * `employee` and `branch` are **not** valid selectors: no evaluation
1006
+ * envelope resolves either slot yet, so a rule targeting one could never
1007
+ * fire. Both are rejected at save time with a 400 explaining why.
1008
+ */
1009
+ target?: {
1010
+ resource: 'customer' | 'account' | 'counterparty' | 'paymentInstrument';
1011
+ };
1012
+ [key: string]: unknown;
479
1013
  }
480
1014
  export interface CreateRuleDto {
481
1015
  /** Rule name. */
482
1016
  name: string;
483
1017
  /** Rule description. */
484
1018
  description?: string;
485
- /** Rule subject. */
1019
+ /** Rule subject: 'TRANSACTION' | 'EVENT' | 'CUSTOMER' | 'ALL'. */
486
1020
  subject: string;
487
- /** Rule trigger. */
1021
+ /**
1022
+ * Rule trigger — the event type that causes evaluation. Core triggers:
1023
+ * `transaction.*` (subject TRANSACTION), `customer.*` / `account.*`
1024
+ * (subject EVENT). Custom triggers use `custom.{slug}` and must name an
1025
+ * ACTIVE event definition (Event Definitions API). `'*'` fires on all
1026
+ * events in the subject's scope. Invalid pairs are rejected with 400.
1027
+ */
488
1028
  trigger?: string;
489
1029
  /** Rule severity. */
490
1030
  severity: 'HIGH' | 'MEDIUM' | 'LOW';
491
- /** Tags for categorisation. */
492
- tags?: string[];
1031
+ /** Tags for categorisation (tag catalogue). */
1032
+ tags?: TagValueInput[];
493
1033
  /** Condition tree (AND/OR logic with leaf conditions). */
494
1034
  conditionTree?: Record<string, unknown>;
495
1035
  /** Actions to execute when the rule triggers. */
496
- actions?: string[];
1036
+ actions?: RuleAction[];
497
1037
  /** Window period for aggregate conditions. */
498
1038
  windowPeriod?: string;
499
1039
  /** Initial status for the rule. */
500
1040
  initialStatus?: 'DRAFT' | 'ACTIVE' | 'DISABLED';
501
1041
  /** Sync key for config-as-code management. */
502
1042
  syncKey?: string;
1043
+ /** Product applicability. Omit or empty products = unscoped. */
1044
+ scope?: {
1045
+ products?: string[];
1046
+ };
503
1047
  }
504
- export interface CreateStakeholderDto {
1048
+ export interface StakeholderInput {
505
1049
  name: string;
506
1050
  role: 'SHAREHOLDER' | 'UBO' | 'DIRECTOR';
507
1051
  /** Ownership percentage (0–100) */
@@ -514,6 +1058,8 @@ export interface CreateStakeholderDto {
514
1058
  /** Link to an existing Entity customer */
515
1059
  entityId?: string;
516
1060
  }
1061
+ /** @deprecated Use `StakeholderInput`. */
1062
+ export type CreateStakeholderDto = StakeholderInput;
517
1063
  export interface CreateWebhookDto {
518
1064
  /** Webhook destination name. */
519
1065
  name: string;
@@ -598,15 +1144,25 @@ export interface EntityResponseDto {
598
1144
  countryOfIncorporation?: string;
599
1145
  dateOfIncorporation?: string;
600
1146
  entityType?: string;
1147
+ /** Tax Identification Number (TIN). */
1148
+ taxId?: string;
601
1149
  parentEntityId?: string;
602
1150
  email?: string;
603
1151
  phone?: string;
604
1152
  riskRating: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
605
1153
  kycTier?: 'NO_KYC' | 'SDD' | 'CDD' | 'EDD' | 'ONGOING';
1154
+ /**
1155
+ * Standing assignment — the users/teams responsible for compliance work on
1156
+ * this customer. NOT ownership ("owner" here means UBO or account owner).
1157
+ * Read by the CUSTOMER_ASSIGNEE routing block, so a new alert can go to
1158
+ * whoever holds the customer.
1159
+ */
1160
+ assignedToUserIds?: string[];
1161
+ assignedToTeamIds?: string[];
606
1162
  alertCount: number;
607
1163
  /** Operational footprint (REGISTERED office, BRANCH, WAREHOUSE, …). Read-only here;
608
1164
  * use granular add/update/remove/verify/reject mutations on the addresses endpoint. */
609
- locations: AddressDto[];
1165
+ addresses: AddressDto[];
610
1166
  createdAt: string;
611
1167
  updatedAt: string;
612
1168
  }
@@ -645,14 +1201,28 @@ export interface IPSessionDto {
645
1201
  country?: string;
646
1202
  isVPN?: boolean;
647
1203
  vpnProvider?: string;
1204
+ asn?: string;
1205
+ networkName?: string;
1206
+ confidence?: number;
648
1207
  }
649
1208
  export interface IdentificationDocumentDto {
1209
+ id?: string;
650
1210
  /** Document type */
651
1211
  type: string;
652
1212
  number: string;
653
1213
  /** ISO 3166-1 alpha-3 country code */
654
- issuingCountry: string;
1214
+ country: string;
1215
+ /**
1216
+ * @deprecated Accepted on write as an alias for `country`, but never
1217
+ * returned — responses have always carried `country`. Read `country`.
1218
+ */
1219
+ issuingCountry?: string;
655
1220
  expiryDate?: string;
1221
+ dateOfIssue?: string;
1222
+ notes?: string;
1223
+ attachments?: AttachmentDto[];
1224
+ /** @deprecated Use `attachments`. */
1225
+ fileIds?: string[];
656
1226
  }
657
1227
  export type IdentificationDocumentStatus = 'PENDING' | 'APPROVED' | 'REJECTED';
658
1228
  /** Computed status — also reflects expiry and archive state. */
@@ -742,7 +1312,7 @@ export interface IdentificationDocument {
742
1312
  status: IdentificationDocumentStatus;
743
1313
  effectiveStatus: IdentificationDocumentEffectiveStatus;
744
1314
  rejectionNarrative?: string;
745
- tags: string[];
1315
+ tags: TagValue[];
746
1316
  attachments: IdDocFileAttachment[];
747
1317
  /** @deprecated Use attachments[].fileId instead. */
748
1318
  fileIds?: string[];
@@ -775,7 +1345,7 @@ export interface CreateIdentificationDocumentInput {
775
1345
  sex?: string;
776
1346
  /** Free-form key/value metadata. */
777
1347
  other?: Record<string, unknown>;
778
- tags?: string[];
1348
+ tags?: TagValueInput[];
779
1349
  attachments?: IdDocFileAttachmentInput[];
780
1350
  notes?: string;
781
1351
  }
@@ -791,7 +1361,7 @@ export interface UpdateIdentificationDocumentInput {
791
1361
  dateOfBirth?: string;
792
1362
  sex?: string;
793
1363
  other?: Record<string, unknown>;
794
- tags?: string[];
1364
+ tags?: TagValueInput[];
795
1365
  attachments?: IdDocFileAttachmentInput[];
796
1366
  notes?: string;
797
1367
  }
@@ -816,7 +1386,7 @@ export interface DeleteIdentificationDocumentResponse {
816
1386
  deletedId: string;
817
1387
  }
818
1388
  /** Resource types that can carry platform comments. */
819
- export type CommentResourceType = 'CUSTOMER' | 'ACCOUNT' | 'TRANSACTION' | 'TASK' | 'ALERT' | 'COMMENT' | 'COUNTERPARTY' | 'DEVICE' | 'RULE' | 'PRODUCT' | 'INSTRUMENT' | 'IDENTIFICATION_DOCUMENT';
1389
+ export type CommentResourceType = 'CUSTOMER' | 'ACCOUNT' | 'TRANSACTION' | 'TASK' | 'ALERT' | 'COMMENT' | 'COUNTERPARTY' | 'DEVICE' | 'RULE' | 'PRODUCT' | 'PAYMENT_INSTRUMENT' | 'IDENTIFICATION_DOCUMENT';
820
1390
  export interface PlatformCommentAttachmentInput {
821
1391
  /** fileId returned by /platform/v1/files/upload-url */
822
1392
  fileId: string;
@@ -828,7 +1398,12 @@ export interface PlatformCommentAttachment extends PlatformCommentAttachmentInpu
828
1398
  /** Short-lived presigned download URL (when resolved by the server). */
829
1399
  downloadUrl?: string;
830
1400
  }
1401
+ export interface CommentLinksInput {
1402
+ /** Screening matches attached to this comment. Empty removes all attachments; omitting links on update preserves them. */
1403
+ matchIds?: string[];
1404
+ }
831
1405
  export interface PlatformCreateCommentDto {
1406
+ links?: CommentLinksInput;
832
1407
  resourceType: CommentResourceType;
833
1408
  resourceId: string;
834
1409
  /** Markdown body (GFM tables supported). */
@@ -838,6 +1413,7 @@ export interface PlatformCreateCommentDto {
838
1413
  externalRequestId?: string;
839
1414
  }
840
1415
  export interface PlatformUpdateCommentDto {
1416
+ links?: CommentLinksInput;
841
1417
  /** Markdown body (GFM tables supported). */
842
1418
  body: string;
843
1419
  }
@@ -846,7 +1422,15 @@ export interface ListPlatformCommentsQuery {
846
1422
  resourceId: string;
847
1423
  }
848
1424
  /** Comment response shape — the OpenAPI spec does not document a full schema, so callers should narrow as needed. */
1425
+ /** Stable references to screening results, with labels retained after a rescreen. */
1426
+ export interface PlatformCommentMatchReference {
1427
+ matchId: string;
1428
+ name: string;
1429
+ category: 'WATCHLIST' | 'HIGH_RISK' | 'CUSTOM_LIST';
1430
+ }
849
1431
  export interface PlatformComment {
1432
+ /** Always present; empty when the comment references no screening result. */
1433
+ matchReferences: PlatformCommentMatchReference[];
850
1434
  id: string;
851
1435
  resourceType: CommentResourceType;
852
1436
  resourceId: string;
@@ -904,10 +1488,20 @@ export interface IndividualResponseDto {
904
1488
  dateOfBirth?: string;
905
1489
  nationality?: string[];
906
1490
  countryOfResidence?: string[];
1491
+ /** Tax Identification Number (TIN). */
1492
+ taxId?: string;
907
1493
  email?: string;
908
1494
  phone?: string;
909
1495
  riskRating: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
910
1496
  kycTier?: 'NO_KYC' | 'SDD' | 'CDD' | 'EDD' | 'ONGOING';
1497
+ /**
1498
+ * Standing assignment — the users/teams responsible for compliance work on
1499
+ * this customer. NOT ownership ("owner" here means UBO or account owner).
1500
+ * Read by the CUSTOMER_ASSIGNEE routing block, so a new alert can go to
1501
+ * whoever holds the customer.
1502
+ */
1503
+ assignedToUserIds?: string[];
1504
+ assignedToTeamIds?: string[];
911
1505
  alertCount: number;
912
1506
  identificationDocuments: IdentificationDocumentDto[];
913
1507
  /** Postal addresses (HOME / MAILING / BILLING / WORK). Read-only here;
@@ -932,22 +1526,65 @@ export interface IngestDevicePayloadDto {
932
1526
  botProbability?: number;
933
1527
  /** Detection confidence score (0-1). */
934
1528
  confidence?: number;
1529
+ /** Device location observation. Multiple observations are retained over time. */
1530
+ location?: LocationObservationDto;
1531
+ }
1532
+ /** Resource an Event occurrence attaches to as its single primary subject. */
1533
+ export type EventResourceType = 'CUSTOMER' | 'ACCOUNT' | 'COUNTERPARTY' | 'EMPLOYEE' | 'BRANCH' | 'PAYMENT_INSTRUMENT';
1534
+ /** Resource a Risk Signal attaches to. */
1535
+ export type RiskSignalResourceType = 'CUSTOMER' | 'ACCOUNT' | 'COUNTERPARTY' | 'EMPLOYEE' | 'BRANCH' | 'PAYMENT_INSTRUMENT';
1536
+ /** The single resource an Event is about. Exactly one, always. */
1537
+ export interface EventResourceRef {
1538
+ type: EventResourceType;
1539
+ /** Id of the resource, which must already exist in your organization. */
1540
+ id: string;
935
1541
  }
936
1542
  export interface IngestEventDto {
1543
+ /**
1544
+ * Your unique identifier for this event (max 255 chars). Used for
1545
+ * idempotency: resubmitting the same eventId returns the original
1546
+ * stored event (`cached: true`) instead of creating a duplicate — safe
1547
+ * for client retries. Omit to skip deduplication.
1548
+ */
1549
+ eventId?: string;
937
1550
  /** Event type (core or custom). Core types: customer.failed_login, customer.profile_updated. Custom types match event definitions. */
938
1551
  type: string;
939
1552
  /** When the event occurred. */
940
1553
  timestamp: string;
941
- /** Customer ID this event is associated with. */
942
- customerId: string;
1554
+ /**
1555
+ * The single resource this event is about. Supply either `resource` or the
1556
+ * legacy top-level `customerId` — `resource` wins when both are present.
1557
+ * An event that names neither is rejected with 400.
1558
+ *
1559
+ * `deviceId` and `sessionId` may qualify an event but never substitute for
1560
+ * its primary resource.
1561
+ */
1562
+ resource?: EventResourceRef;
1563
+ /**
1564
+ * Customer this event relates to.
1565
+ *
1566
+ * Two roles: as the legacy attachment field it is exactly equivalent to
1567
+ * `resource: { type: 'CUSTOMER', id }`, and alongside a non-customer
1568
+ * `resource` it is context that customer-scoped event aggregates read.
1569
+ *
1570
+ * @deprecated `resource` is the contract. A bare `customerId` is still
1571
+ * accepted as the legacy spelling of `resource: { type: 'CUSTOMER', id }`,
1572
+ * but new integrations should send `resource` — it is the only way to
1573
+ * attach an event to an account, counterparty, employee, branch, or
1574
+ * payment instrument.
1575
+ */
1576
+ customerId?: string;
943
1577
  /** Account ID if the event is account-scoped. */
944
1578
  accountId?: string;
945
1579
  /** Device identifier for device-context rules. */
946
1580
  deviceId?: string;
947
1581
  /** Session identifier for session-context rules. */
948
1582
  sessionId?: string;
949
- /** Event-specific payload data. Schema depends on event type. */
950
- data?: Record<string, unknown>;
1583
+ /**
1584
+ * Typed payload (Typed Fields primitive, Tier B). Validated via the
1585
+ * canonical TypedFields validator and stored in `events.fields`.
1586
+ */
1587
+ fields?: TypedFieldValueInput[];
951
1588
  }
952
1589
  export interface IngestTransactionDto {
953
1590
  /** Your unique identifier for this transaction. Used for idempotency. */
@@ -956,8 +1593,8 @@ export interface IngestTransactionDto {
956
1593
  timestamp: string;
957
1594
  /** The transaction payload. */
958
1595
  transaction: TransactionBodyDto;
959
- /** Payment instrument used for this transaction. */
960
- instrument?: InstrumentPayloadDto;
1596
+ /** Canonical Payment Instrument identity or protected credential for deterministic create-on-miss resolution. */
1597
+ paymentInstrument?: PaymentInstrumentPayloadDto;
961
1598
  /** Intermediary banks/institutions in the payment chain. */
962
1599
  intermediaries?: IntermediaryDto[];
963
1600
  /** Device / fingerprint data used for device-based rules and device-trust resolution. */
@@ -965,9 +1602,172 @@ export interface IngestTransactionDto {
965
1602
  /** Set to true for async processing. Returns 202 Accepted immediately; results delivered via webhook. */
966
1603
  async?: boolean;
967
1604
  }
968
- export interface InitializeSetupDto {
969
- /** Admin user full name */
970
- name: string;
1605
+ /** Why a payment operation failed to become a transaction in the source system. */
1606
+ export type TransactionAttemptOutcome = 'FAILED' | 'BLOCKED' | 'UNKNOWN';
1607
+ export interface TransactionAttemptOutcomeDto {
1608
+ type: TransactionAttemptOutcome;
1609
+ code?: string;
1610
+ reason?: string;
1611
+ /** System or provider that supplied the outcome. */
1612
+ source?: string;
1613
+ retryable?: boolean;
1614
+ /** Whether the integration considers this the final outcome for the operation. */
1615
+ final?: boolean;
1616
+ }
1617
+ export interface AttemptedAmountDto {
1618
+ /** Attempted value in the supplied currency's minor units. */
1619
+ amountMinor: number;
1620
+ /** Structured currency code, for example `FIAT:USD`. */
1621
+ currency: string;
1622
+ precision: number;
1623
+ }
1624
+ /**
1625
+ * Durable behavioural record for an operation that did not become a source
1626
+ * transaction. Snapshot objects must contain safe descriptors only—never PANs,
1627
+ * raw payment tokens, API keys, or unprotected device fingerprints.
1628
+ */
1629
+ export interface IngestTransactionAttemptDto {
1630
+ /** Tenant-scoped idempotency key. */
1631
+ attemptId: string;
1632
+ /** When the source system observed the attempt. */
1633
+ timestamp: string;
1634
+ /** Integration-defined payment operation, for example `CARD_AUTHORIZATION`. */
1635
+ operation: string;
1636
+ outcome: TransactionAttemptOutcomeDto;
1637
+ amount?: AttemptedAmountDto;
1638
+ direction?: 'IN' | 'OUT';
1639
+ mode?: Record<string, unknown>;
1640
+ channel?: Record<string, unknown>;
1641
+ authentication?: Record<string, unknown>;
1642
+ principalParty?: Record<string, unknown>;
1643
+ counterparty?: Record<string, unknown>;
1644
+ /** Lookup-only Payment Instrument reference. A miss never creates a Payment Instrument. */
1645
+ paymentInstrument?: AttemptPaymentInstrumentDto;
1646
+ device?: Record<string, unknown>;
1647
+ context?: Record<string, unknown>;
1648
+ }
1649
+ export interface IngestTransactionAttemptResponse {
1650
+ attemptId: string;
1651
+ /** Database record ID. */
1652
+ id: string;
1653
+ /** True when an identical tenant-scoped replay returned the existing record. */
1654
+ cached: boolean;
1655
+ observedAt: string;
1656
+ expiresAt: string;
1657
+ }
1658
+ export type AttemptCoverage = 'ALL' | 'SELECTIVE';
1659
+ /**
1660
+ * What event ingestion does with a type that has no Event Definition.
1661
+ * `ACCEPT` (the default) records it as history that links to no Definition and
1662
+ * emits no Risk Signals; `REJECT` fails the request instead.
1663
+ */
1664
+ export type UnknownEventTypePolicy = 'ACCEPT' | 'REJECT';
1665
+ export interface TenantBehaviorSettings {
1666
+ attemptRetentionDays: number;
1667
+ attemptCoverage: AttemptCoverage;
1668
+ unknownEventTypes: UnknownEventTypePolicy;
1669
+ }
1670
+ export interface UpdateTenantBehaviorSettingsInput {
1671
+ attemptRetentionDays?: number;
1672
+ attemptCoverage?: AttemptCoverage;
1673
+ unknownEventTypes?: UnknownEventTypePolicy;
1674
+ }
1675
+ export interface ListTransactionAttemptsInput {
1676
+ limit?: number;
1677
+ cursor?: string;
1678
+ outcomes?: TransactionAttemptOutcome[];
1679
+ operation?: string;
1680
+ observedFrom?: string;
1681
+ observedTo?: string;
1682
+ customerId?: string;
1683
+ accountId?: string;
1684
+ counterpartyId?: string;
1685
+ paymentInstrumentId?: string;
1686
+ deviceId?: string;
1687
+ sessionId?: string;
1688
+ channelEndpointId?: string;
1689
+ iin?: string;
1690
+ }
1691
+ /** Safe read projection. Protected request/fingerprint/IP hashes are never returned. */
1692
+ export interface TransactionAttemptDto {
1693
+ id: string;
1694
+ attemptId: string;
1695
+ observedAt: string;
1696
+ outcome: TransactionAttemptOutcome;
1697
+ outcomeCode?: string | null;
1698
+ outcomeReason?: string | null;
1699
+ outcomeSource?: string | null;
1700
+ retryable?: boolean | null;
1701
+ final: boolean;
1702
+ operation: string;
1703
+ mode?: Record<string, unknown> | null;
1704
+ channel?: Record<string, unknown> | null;
1705
+ authentication?: Record<string, unknown> | null;
1706
+ direction?: 'IN' | 'OUT' | null;
1707
+ originAmountMinor?: number | null;
1708
+ originCurrency?: string | null;
1709
+ originPrecision?: number | null;
1710
+ baseAmountMinor?: number | null;
1711
+ baseCurrency?: string | null;
1712
+ basePrecision?: number | null;
1713
+ customerId?: string | null;
1714
+ accountId?: string | null;
1715
+ counterpartyId?: string | null;
1716
+ paymentInstrumentId?: string | null;
1717
+ deviceId?: string | null;
1718
+ sessionId?: string | null;
1719
+ channelEndpointId?: string | null;
1720
+ iin?: string | null;
1721
+ countryCode?: string | null;
1722
+ principalParty?: Record<string, unknown> | null;
1723
+ counterparty?: Record<string, unknown> | null;
1724
+ paymentInstrument?: Record<string, unknown> | null;
1725
+ device?: Record<string, unknown> | null;
1726
+ context?: Record<string, unknown> | null;
1727
+ expiresAt: string;
1728
+ createdAt: string;
1729
+ }
1730
+ export interface TransactionAttemptPage {
1731
+ items: TransactionAttemptDto[];
1732
+ nextCursor?: string | null;
1733
+ }
1734
+ export interface ContributingAttemptFact {
1735
+ attemptId: string;
1736
+ observedAt: string;
1737
+ outcome?: string;
1738
+ operation?: string;
1739
+ customerId?: string | null;
1740
+ accountId?: string | null;
1741
+ counterpartyId?: string | null;
1742
+ paymentInstrumentId?: string | null;
1743
+ deviceId?: string | null;
1744
+ sessionId?: string | null;
1745
+ channelEndpointId?: string | null;
1746
+ originAmountMinor?: number | null;
1747
+ originCurrency?: string | null;
1748
+ originPrecision?: number | null;
1749
+ baseAmountMinor?: number | null;
1750
+ baseCurrency?: string | null;
1751
+ basePrecision?: number | null;
1752
+ iin?: string | null;
1753
+ countryCode?: string | null;
1754
+ ipLookupHash?: string | null;
1755
+ }
1756
+ export interface AlertAttemptEvidence {
1757
+ id: string;
1758
+ alertId: string;
1759
+ ruleId: string;
1760
+ ruleVersion?: number | null;
1761
+ attempts: ContributingAttemptFact[];
1762
+ contributingAttemptCount: number;
1763
+ capturedAttemptCount: number;
1764
+ truncated: boolean;
1765
+ capturedAt: string;
1766
+ retainedUntil?: string | null;
1767
+ }
1768
+ export interface InitializeSetupDto {
1769
+ /** Admin user full name */
1770
+ name: string;
971
1771
  /** Admin email address */
972
1772
  email: string;
973
1773
  /** Admin password (min 8 characters) */
@@ -976,6 +1776,8 @@ export interface InitializeSetupDto {
976
1776
  organizationName: string;
977
1777
  /** Organization slug (URL-friendly identifier) */
978
1778
  organizationSlug: string;
1779
+ /** Definition of the tenant base currency. Created as the only currency at setup. Defaults to FIAT USD. */
1780
+ baseCurrency?: CreateCurrencyInput;
979
1781
  /** Enable Transaction Intelligence product */
980
1782
  transactionIntelligence?: boolean;
981
1783
  /** Enable KYC vendor integration (within Customer Monitoring) */
@@ -986,18 +1788,6 @@ export interface InstitutionDetailsDto {
986
1788
  lei?: string;
987
1789
  regulatoryStatus?: string;
988
1790
  }
989
- export interface InstrumentPayloadDto {
990
- /** Instrument identifier. */
991
- id: string;
992
- /** Human-readable name persisted as instruments.displayName (e.g. "Personal Visa", "Travel Card"). */
993
- name?: string;
994
- /** Instrument type (CARD, VIRTUAL_CARD, WALLET_TOKEN, etc.). */
995
- type?: string;
996
- /** Instrument status (ACTIVE, BLOCKED, EXPIRED, etc.). */
997
- status?: string;
998
- /** Token or masked identifier. */
999
- token?: string;
1000
- }
1001
1791
  export interface IntermediaryDto {
1002
1792
  /** Role of the intermediary (e.g. CORRESPONDENT, CLEARING_BANK). */
1003
1793
  role: string;
@@ -1091,7 +1881,11 @@ export interface OtherPaymentDetailsDto {
1091
1881
  }
1092
1882
  export interface PaginationMeta {
1093
1883
  /** Cursor to fetch the next page, null if no more results */
1094
- nextCursor: Record<string, unknown> | null;
1884
+ /**
1885
+ * Opaque cursor for the next page — the last row's id — or `null` on the
1886
+ * final page. Pass it straight back as `cursor`.
1887
+ */
1888
+ nextCursor: string | null;
1095
1889
  /** Total number of items matching the query */
1096
1890
  totalCount: number;
1097
1891
  }
@@ -1107,8 +1901,79 @@ export interface PatchTransactionStatusDto {
1107
1901
  /** Human-readable reason for terminal transitions (REJECTED, REVERSED, BLOCKED). Stored in statusHistory for audit. */
1108
1902
  terminalReason?: string;
1109
1903
  }
1904
+ /** Integer minor-unit amount with the currency and precision needed to display it. */
1905
+ export interface MonetaryAmountDto {
1906
+ /** Integer amount in minor units (cents, satoshi, …). */
1907
+ amountMinor: number;
1908
+ /** Currency in `TYPE:CODE` form, e.g. `FIAT:USD`. */
1909
+ currency: string;
1910
+ /** Decimal places: `major = amountMinor / 10^precision`. */
1911
+ precision: number;
1912
+ }
1913
+ export interface TransactionStatusHistoryEntryDto {
1914
+ from?: string;
1915
+ to: string;
1916
+ /** ISO 8601 — when the change occurred in the caller's system. */
1917
+ changedAt: string;
1918
+ reason?: string;
1919
+ }
1920
+ /**
1921
+ * A stored transaction as the platform holds it after ingestion: the caller's
1922
+ * payload plus what resolution and normalisation added. Returned by
1923
+ * `GET /v1/transactions/{transactionId}`.
1924
+ */
1925
+ export interface TransactionResponseDto {
1926
+ /** Internal transaction UUID (the `id` returned by `POST /transactions`). */
1927
+ id: string;
1928
+ /** Caller-supplied reference (the `transactionId` sent on ingest). */
1929
+ transactionId: string;
1930
+ kind: 'TRANSFER' | 'ACCOUNT_ENTRY' | (string & {});
1931
+ status: 'PENDING' | 'PROCESSING' | 'COMPLETE' | 'REJECTED' | 'REVERSED' | 'BLOCKED' | (string & {});
1932
+ statusChangedAt?: string | null;
1933
+ statusHistory?: TransactionStatusHistoryEntryDto[];
1934
+ /** Immutable window anchor. */
1935
+ executedAt: string;
1936
+ settledAt?: string | null;
1937
+ direction?: 'IN' | 'OUT' | null;
1938
+ entryType?: string | null;
1939
+ mode?: Record<string, unknown> | null;
1940
+ channel?: Record<string, unknown> | null;
1941
+ memo?: string | null;
1942
+ /** Amount as ingested. */
1943
+ origin: MonetaryAmountDto;
1944
+ /** Amount normalised to the tenant base currency. */
1945
+ base?: MonetaryAmountDto | null;
1946
+ destination?: MonetaryAmountDto | null;
1947
+ baseExchangeRate?: number | null;
1948
+ fees?: unknown[] | null;
1949
+ baseFeeTotalMinor?: number | null;
1950
+ paymentInfo?: Record<string, unknown> | null;
1951
+ principalParty?: Record<string, unknown> | null;
1952
+ counterparty?: Record<string, unknown> | null;
1953
+ customerId?: string | null;
1954
+ accountId?: string | null;
1955
+ counterpartyId?: string | null;
1956
+ counterpartyPaymentMethodId?: string | null;
1957
+ counterpartyResolutionStatus?: string | null;
1958
+ /** @deprecated Mirrors `paymentInstrumentId`. */
1959
+ instrumentId?: string | null;
1960
+ paymentInstrumentId?: string | null;
1961
+ channelEndpointId?: string | null;
1962
+ deviceId?: string | null;
1963
+ sessionId?: string | null;
1964
+ isInternalTxn?: boolean | null;
1965
+ isSelfTransfer?: boolean | null;
1966
+ internalCounterpartyCustomerId?: string | null;
1967
+ internalCounterpartyAccountId?: string | null;
1968
+ relatedTransactions?: unknown[] | null;
1969
+ isFlagged: boolean;
1970
+ flaggedAlertIds: string[];
1971
+ metadata?: Record<string, unknown> | null;
1972
+ createdAt: string;
1973
+ updatedAt: string;
1974
+ }
1110
1975
  export interface PaymentDetailsDto {
1111
- /** Discriminator selecting which payment subtype block to populate. NOTE: card-on-file (the instrument the principal customer paid with) is modelled separately on the transaction `instrument` field — counterparty payment details describe how the OTHER party receives money. */
1976
+ /** Discriminator selecting which payment subtype block to populate. NOTE: the Payment Instrument used by the principal customer is modelled separately on the transaction `paymentInstrument` field — counterparty payment details describe how the counterparty receives money. */
1112
1977
  type: 'BANK_ACCOUNT' | 'CRYPTO_WALLET' | 'DIGITAL_WALLET' | 'MERCHANT' | 'PROCESSOR' | 'CASH' | 'CHECK' | 'ATM' | 'OTHER';
1113
1978
  bankAccount?: BankAccountDetailsDto;
1114
1979
  cryptoWallet?: CryptoWalletDetailsDto;
@@ -1154,11 +2019,20 @@ export interface PaymentLocationAddressDto {
1154
2019
  /** ISO 3166-1 alpha-3 country code. */
1155
2020
  country?: string;
1156
2021
  }
2022
+ /**
2023
+ * A point on an ingested payment location.
2024
+ *
2025
+ * Both spellings are accepted; send either. Exactly one point is stored.
2026
+ */
1157
2027
  export interface PaymentLocationCoordinatesDto {
1158
2028
  /** Latitude (WGS84). */
1159
- lat: number;
2029
+ latitude?: number;
1160
2030
  /** Longitude (WGS84). */
1161
- lng: number;
2031
+ longitude?: number;
2032
+ /** Latitude (WGS84). Prefer `latitude`. */
2033
+ lat?: number;
2034
+ /** Longitude (WGS84). Prefer `longitude`. */
2035
+ lng?: number;
1162
2036
  }
1163
2037
  export interface PlaceOfBirthDto {
1164
2038
  cityOfBirth?: string;
@@ -1219,13 +2093,22 @@ export interface RegisterDeviceBrowserDetailsDto {
1219
2093
  userAgent?: string;
1220
2094
  }
1221
2095
  export interface RegisterDeviceDto {
1222
- /** Fingerprint provider identifier for the device */
1223
- fingerprint: string;
1224
- browserDetails: RegisterDeviceBrowserDetailsDto;
1225
- /** IP sessions observed for the device */
1226
- ipSessions?: unknown[];
2096
+ /** Raw identities used only for tenant-bound protected resolution; values are never persisted or returned. */
2097
+ fingerprints: RegisterDeviceFingerprintDto[];
2098
+ browserDetails?: RegisterDeviceBrowserDetailsDto;
1227
2099
  botProbability?: number;
1228
2100
  confidence?: number;
2101
+ /** ISO 8601 observation time. Defaults to server receipt time. */
2102
+ observedAt?: string;
2103
+ }
2104
+ export interface RegisterDeviceFingerprintDto {
2105
+ /** Raw identity value used in memory only. */
2106
+ value: string;
2107
+ /** Provider namespace. Defaults to INGEST to converge with transaction ingestion. */
2108
+ provider?: string;
2109
+ /** Provider-qualified identity type. Defaults to DEVICE. */
2110
+ type?: string;
2111
+ confidence?: number;
1229
2112
  }
1230
2113
  export interface RelatedTransactionDto {
1231
2114
  /** Transaction ID of the related transaction. Use the same identifier format as `transactionId` (your external reference). */
@@ -1253,7 +2136,7 @@ export interface RiskAssessmentAnswerDto {
1253
2136
  selectedOptionId?: string;
1254
2137
  notes?: string;
1255
2138
  }
1256
- export interface RiskQuestionnaireAnswerDto {
2139
+ export interface CustomerRiskAssessmentAnswerDto {
1257
2140
  questionId: string;
1258
2141
  question: string;
1259
2142
  answer: string;
@@ -1269,9 +2152,23 @@ export interface TaxIdentificationDto {
1269
2152
  /** YYYY-MM-DD */
1270
2153
  registrationDate?: string;
1271
2154
  }
2155
+ /**
2156
+ * Ledger-line classification for an `ACCOUNT_ENTRY` transaction — a fee, an
2157
+ * interest movement, a payment, or an adjustment.
2158
+ */
2159
+ export type AccountEntryType = 'MONTHLY_FEE' | 'WIRE_FEE' | 'OVERDRAFT_FEE' | 'LATE_PAYMENT_FEE' | 'ANNUAL_FEE' | 'ATM_FEE' | 'FOREIGN_TRANSACTION_FEE' | 'INTEREST_CHARGE' | 'INTEREST_PAYMENT' | 'PRINCIPAL_PAYMENT' | 'ESCROW_PAYMENT' | 'MINIMUM_PAYMENT' | 'STATEMENT_PAYMENT' | 'REWARD_REDEMPTION' | 'CASHBACK' | 'ADJUSTMENT' | 'CHARGEBACK' | 'PROMOTIONAL_CREDIT' | 'PENALTY' | 'REFUND';
1272
2160
  export interface TransactionBodyDto {
1273
2161
  /** Transaction kind discriminator. */
1274
2162
  kind: 'TRANSFER' | 'ACCOUNT_ENTRY';
2163
+ /**
2164
+ * What kind of ledger line an `ACCOUNT_ENTRY` is — a fee, an interest
2165
+ * credit, an adjustment, and so on.
2166
+ *
2167
+ * Required when `kind` is `'ACCOUNT_ENTRY'`, ignored for `'TRANSFER'`. The
2168
+ * read model exposes it as non-nullable, so an account entry ingested
2169
+ * without one cannot be rendered.
2170
+ */
2171
+ entryType?: AccountEntryType;
1275
2172
  /** Two-level payment classification: closed category enum + open method string. */
1276
2173
  mode: Record<string, unknown>;
1277
2174
  /** Channel and session context for the transaction. */
@@ -1290,6 +2187,8 @@ export interface TransactionBodyDto {
1290
2187
  reference?: string;
1291
2188
  /** Free-text memo or note. */
1292
2189
  memo?: string;
2190
+ /** Resource tags for this transaction, as catalogue values (slugs) or labels from the `txn.tags` tag catalogue (Settings → Tags). Stored on `transactions.tags`, read by rules as the `txn.tags` set field, and filterable inside aggregate brackets — e.g. `account.txn(24h).sum(amount)[tags IN (top-up)]`. Values not in the catalogue are rejected (HTTP 400). Tags are written at ingest only; status updates leave them unchanged. */
2191
+ tags?: string[];
1293
2192
  /** IDs of related transactions (e.g. funding legs, reversals, fees). Useful when multiple transactions form a single logical transfer. */
1294
2193
  relatedTransactions?: RelatedTransactionDto[];
1295
2194
  /** Open per-transaction key/value bag stored on `transactions.metadata` and exposed to the rules engine as `txn.metadata.{key}`. Each value is either a **bare primitive** (string / number / boolean — coerced to `text` at ingest) or a **typed wrapper** `{ "type": "...", "value": ... }` so the evaluator can run typed comparisons. See spec evaluation/02 §1.M.
@@ -1302,23 +2201,22 @@ export interface TransactionBodyDto {
1302
2201
  metadata?: Record<string, string | number | boolean | MetadataTextWrapperDto | MetadataNumberWrapperDto | MetadataBooleanWrapperDto | MetadataDateWrapperDto | MetadataSetWrapperDto | MetadataCurrencyWrapperDto | MetadataMonetaryWrapperDto>;
1303
2202
  }
1304
2203
  export interface UpdateAccountDto {
1305
- /** Product ID this account is based on */
1306
- productId?: string;
1307
2204
  label?: string;
1308
- /** Currency code (ISO 4217) */
1309
- currency?: string;
1310
- bankName?: string;
1311
- bankSwift?: string;
1312
- iban?: string;
1313
- accountNumber?: string;
1314
- /** Arbitrary key-value properties */
1315
- customProperties?: Record<string, unknown>;
1316
2205
  /** Override account opening timestamp (ISO 8601). Used by data-loading tools to backfill historical accounts. */
1317
2206
  openedAt?: string;
2207
+ /**
2208
+ * Typed Field write input (Tier A). Merge semantics — supplied keys
2209
+ * overwrite the stored bag, absent keys are preserved. Pass `[]` to clear.
2210
+ * Banking-style values (IBAN, SWIFT, account number, …) live here now,
2211
+ * not as flat columns (Phase 3b).
2212
+ */
2213
+ fields?: TypedFieldValueInput[];
2214
+ /** Untyped escape hatch (Tier C). Stored verbatim. */
2215
+ otherProperties?: UntypedKeyValueInput[];
1318
2216
  }
1319
2217
  export interface UpdateConstantDto {
1320
2218
  /** Constant type. If changed, `value` must be re-supplied in the new shape. */
1321
- type?: 'scalar' | 'monetary' | 'set' | 'range' | 'text' | 'number' | 'boolean' | 'date' | 'currency';
2219
+ type?: 'scalar' | 'monetary' | 'set' | 'range' | 'text' | 'number' | 'boolean' | 'date' | 'currency' | 'regex';
1322
2220
  /** Payload shape depends on the constant's `type`. Pick the matching variant below. Validated at write time. */
1323
2221
  value?: {
1324
2222
  /** e.g. `"1000000@FIAT:USD"` = $10,000.00. Precision implied by currency: USD=2, JPY=0, BTC=8, ETH=9, USDT/USDC=6. */
@@ -1347,10 +2245,30 @@ export interface UpdateCounterpartyDto {
1347
2245
  institution?: InstitutionDetailsDto;
1348
2246
  }
1349
2247
  /** OpenAPI schema is empty; treated as an opaque key/value bag — narrow on the caller side. */
1350
- export type UpdateCurrencyInput = Record<string, unknown>;
2248
+ export interface UpdateCurrencyInput {
2249
+ name?: string;
2250
+ symbol?: string;
2251
+ /** Number of minor-unit decimal places (0–18). */
2252
+ precision?: number;
2253
+ isEnabled?: boolean;
2254
+ }
1351
2255
  export interface UpdateDeviceTrustDto {
1352
2256
  trustLevel: 'KNOWN' | 'NEW' | 'SUSPICIOUS';
1353
2257
  }
2258
+ export interface MergeDeviceDto {
2259
+ sourceDeviceId: string;
2260
+ reason: string;
2261
+ }
2262
+ export interface DeviceMergeResponseDto {
2263
+ id: string;
2264
+ organizationId: string;
2265
+ sourceDeviceId: string;
2266
+ targetDeviceId: string;
2267
+ canonicalDeviceId: string;
2268
+ reason: string;
2269
+ mergedBy: Record<string, unknown>;
2270
+ mergedAt: string;
2271
+ }
1354
2272
  export interface UpdateEntityDto {
1355
2273
  legalName?: string;
1356
2274
  tradingNames?: string[];
@@ -1359,6 +2277,8 @@ export interface UpdateEntityDto {
1359
2277
  countryOfIncorporation?: string;
1360
2278
  dateOfIncorporation?: string;
1361
2279
  entityType?: string;
2280
+ /** Tax Identification Number (TIN). */
2281
+ taxId?: string;
1362
2282
  /** Parent entity ID for subsidiaries */
1363
2283
  parentEntityId?: string;
1364
2284
  email?: string;
@@ -1384,8 +2304,22 @@ export interface UpdateEventDefinitionDto {
1384
2304
  description?: string;
1385
2305
  /** Event category. */
1386
2306
  category?: string;
1387
- /** Event properties schema. */
1388
- properties?: Record<string, unknown>[];
2307
+ /** Event definition status. */
2308
+ status?: 'ACTIVE' | 'DEPRECATED' | 'DRAFT';
2309
+ /**
2310
+ * Resources this event names, each as SUBJECT (what an occurrence is
2311
+ * about) or CONTEXT (what it also references). Omit to accept any
2312
+ * attachable subject and expect no context.
2313
+ */
2314
+ resources?: EventResourceDeclarationDto[];
2315
+ /** Event property schema. Same shape as `TypedFieldDefinition` (including `options` for select types). */
2316
+ properties?: TypedFieldDefinition[];
2317
+ /**
2318
+ * Risk Signals to emit on every valid occurrence of this event. Supplying
2319
+ * the array replaces the declared effects; signals already recorded keep
2320
+ * the weight and half-life snapshotted when they were created.
2321
+ */
2322
+ riskSignalEffects?: RiskSignalEffect[];
1389
2323
  }
1390
2324
  export interface UpdateExpectedActivityDto {
1391
2325
  expectedMonthlyTransactionCount: number;
@@ -1417,6 +2351,8 @@ export interface UpdateIndividualDto {
1417
2351
  countryOfResidence?: string[];
1418
2352
  /** Additional name variants the customer is known by. */
1419
2353
  aliases?: string[];
2354
+ /** Tax Identification Number (TIN). */
2355
+ taxId?: string;
1420
2356
  email?: string;
1421
2357
  phone?: string;
1422
2358
  identificationDocuments?: IdentificationDocumentDto[];
@@ -1480,38 +2416,86 @@ export interface UpdateProductDto {
1480
2416
  /** Product description. */
1481
2417
  description?: string;
1482
2418
  /** Product status. */
1483
- status?: string;
2419
+ status?: ProductStatus;
2420
+ /** Preferred product classification, governed by the `product.tags` catalogue. */
2421
+ tags?: TagValueInput[];
1484
2422
  /** Supported transaction method IDs. */
1485
2423
  supportedMethodIds?: string[];
1486
- /** Arbitrary product metadata. */
1487
- metadata?: Record<string, unknown>;
2424
+ /** Account field template for accounts created from this product. */
2425
+ accountFieldConfig?: TypedFieldDefinition[];
2426
+ /** @deprecated Use `accountFieldConfig`. */
2427
+ typedAccountFieldConfig?: TypedFieldDefinition[];
2428
+ /** Product-level typed bag (Tier B, self-declaring). */
2429
+ fields?: TypedFieldValueInput[];
2430
+ /** Untyped escape hatch (Tier C). */
2431
+ otherProperties?: UntypedKeyValueInput[];
1488
2432
  }
1489
2433
  export interface UpdateRiskRatingDto {
1490
2434
  riskRating: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
1491
2435
  /** Justification for the override */
1492
2436
  justification?: string;
1493
2437
  }
2438
+ /** Lifecycle status of a customer (individual or entity). */
2439
+ export type CustomerStatus = 'ONBOARDING' | 'IN_REVIEW' | 'ACTIVE' | 'INACTIVE' | 'SUSPENDED' | 'REJECTED';
2440
+ export interface UpdateCustomerStatusDto {
2441
+ /** New lifecycle status for the customer. */
2442
+ status: CustomerStatus;
2443
+ /** Audit reason for the status change. */
2444
+ reason?: string;
2445
+ }
2446
+ export interface UpdateCustomerStatusResponse {
2447
+ customerId: string;
2448
+ status: CustomerStatus;
2449
+ statusReason: string | null;
2450
+ updatedAt: string;
2451
+ }
2452
+ /** Body for archiving a customer (admin-only, irreversible). */
2453
+ export interface ArchiveCustomerDto {
2454
+ /** Audit reason for archiving the customer. */
2455
+ reason?: string;
2456
+ }
2457
+ export interface ArchiveCustomerResponse {
2458
+ customerId: string;
2459
+ /** When the customer was archived (ISO 8601). */
2460
+ archivedAt: string | null;
2461
+ /** The original (clean) external ID, preserved for audit. The live external ID is freed for reuse. */
2462
+ archivedExternalId: string | null;
2463
+ archivedReason: string | null;
2464
+ }
1494
2465
  export interface UpdateRuleDto {
1495
2466
  /** Rule name. */
1496
2467
  name?: string;
1497
2468
  /** Rule description. */
1498
2469
  description?: string;
1499
- /** Rule subject. */
2470
+ /** Rule subject: 'TRANSACTION' | 'EVENT' | 'CUSTOMER' | 'ALL'. */
1500
2471
  subject?: string;
1501
- /** Rule trigger. */
2472
+ /**
2473
+ * Rule trigger — see CreateRuleDto.trigger. The post-update
2474
+ * subject/trigger pair is validated, so patching only the trigger must
2475
+ * still be compatible with the rule's existing subject.
2476
+ */
1502
2477
  trigger?: string;
1503
2478
  /** Rule severity. */
1504
2479
  severity?: 'HIGH' | 'MEDIUM' | 'LOW';
1505
- /** Tags for categorisation. */
1506
- tags?: string[];
2480
+ /** Tags for categorisation (tag catalogue). */
2481
+ tags?: TagValueInput[];
1507
2482
  /** Rule status. */
1508
2483
  status?: 'DRAFT' | 'ACTIVE' | 'DISABLED';
1509
2484
  /** Condition tree. */
1510
2485
  conditionTree?: Record<string, unknown>;
1511
2486
  /** Actions to execute. */
1512
- actions?: string[];
2487
+ actions?: RuleAction[];
1513
2488
  /** Window period. */
1514
2489
  windowPeriod?: string;
2490
+ /**
2491
+ * Optional note recorded against the version this edit mints (audit trail).
2492
+ * Ignored if the edit changes no definitional field.
2493
+ */
2494
+ changeNote?: string;
2495
+ /** Product applicability. Pass null or empty products to unscope. */
2496
+ scope?: {
2497
+ products?: string[];
2498
+ } | null;
1515
2499
  }
1516
2500
  export interface UpdateStakeholderDto {
1517
2501
  name?: string;
@@ -1565,6 +2549,8 @@ export interface IngestTransactionResponse {
1565
2549
  matches: IngestTransactionMatch[];
1566
2550
  /** Server-side evaluation time in milliseconds. */
1567
2551
  executionTimeMs: number;
2552
+ /** The stored transaction after resolution and evaluation — the same shape `transactions.get()` returns. */
2553
+ transaction?: TransactionResponseDto;
1568
2554
  }
1569
2555
  /** Async response (202) from POST /v1/transactions when accepted for background processing. */
1570
2556
  export interface IngestTransactionAsyncResponse {
@@ -1572,12 +2558,44 @@ export interface IngestTransactionAsyncResponse {
1572
2558
  id: string;
1573
2559
  async: true;
1574
2560
  status: 'ACCEPTED' | string;
2561
+ /** The stored transaction after resolution; evaluation has not run yet, so flags are not set. */
2562
+ transaction?: TransactionResponseDto;
1575
2563
  }
1576
2564
  export interface IngestEventResponse {
1577
- /** Database record ID for the ingested event. */
2565
+ /**
2566
+ * Echo of the request `eventId`; the database record ID when the
2567
+ * request carried none.
2568
+ */
1578
2569
  eventId: string;
2570
+ /** Database record ID for the ingested event. */
2571
+ id: string;
1579
2572
  /** Echoed event type. */
1580
2573
  type: string;
2574
+ /**
2575
+ * The Event Definition the type resolved to. `null` means the type has no
2576
+ * Definition: the occurrence is recorded, but nothing described it and no
2577
+ * Risk Signal fired for it — catch a typo here rather than by noticing the
2578
+ * absence of signals days later. A tenant that would rather the request
2579
+ * fail sets the `unknownEventTypes` behaviour setting to `REJECT`.
2580
+ */
2581
+ definitionId: string | null;
2582
+ /**
2583
+ * The resolved primary resource the event was attached to. Echoed back
2584
+ * resolved, so a request that used the legacy `customerId` spelling reads
2585
+ * back as `{ type: 'CUSTOMER', id }`.
2586
+ */
2587
+ resource: EventResourceRef;
2588
+ /**
2589
+ * Ids of the Risk Signals the event definition's `riskSignalEffects`
2590
+ * emitted for this occurrence. Empty when the definition declares none.
2591
+ *
2592
+ * The Event and its signals are written in one transaction, and a replay
2593
+ * echoes the signals the original ingestion produced — the event's
2594
+ * idempotency covers its Risk Signals too.
2595
+ */
2596
+ riskSignalIds: string[];
2597
+ /** Present (true) when this request deduplicated against an already-stored event. */
2598
+ cached?: boolean;
1581
2599
  }
1582
2600
  export interface CursorPaginationQuery {
1583
2601
  cursor?: string;
@@ -1591,6 +2609,10 @@ export interface ListCurrenciesQuery {
1591
2609
  export interface SyncKeyQuery {
1592
2610
  syncKey?: string;
1593
2611
  }
2612
+ export interface ListConstantsQuery extends SyncKeyQuery {
2613
+ /** Restrict to product-bound `$account.*` definitions for this product. */
2614
+ productId?: string;
2615
+ }
1594
2616
  export interface DeleteConstantQuery {
1595
2617
  force?: boolean;
1596
2618
  reason?: string;
@@ -1599,6 +2621,11 @@ export interface GetCustomerQuery {
1599
2621
  /** If true, treat the path id as an external customer ID. */
1600
2622
  isExternal?: boolean;
1601
2623
  }
2624
+ /**
2625
+ * Response DTOs not enumerated in the public OpenAPI schema. The backend
2626
+ * returns these as full objects but the OpenAPI spec does not publish their
2627
+ * shape. Treated as opaque records — narrow on the caller side.
2628
+ */
1602
2629
  export type OpaqueResponse = Record<string, unknown>;
1603
2630
  export type ApiKeyResponseDto = OpaqueResponse;
1604
2631
  export type TokenResponseDto = OpaqueResponse;
@@ -1640,20 +2667,498 @@ export interface PlatformUploadUrlResponseDto {
1640
2667
  /** Response shape for `POST /v1/platform/v1/files/confirm` — typically `{ fileId, downloadUrl, ... }`. */
1641
2668
  export type PlatformConfirmUploadResponseDto = OpaqueResponse;
1642
2669
  export type StakeholderResponseDto = OpaqueResponse;
1643
- export type DeviceResponseDto = OpaqueResponse;
1644
- export type DeviceSummaryDto = OpaqueResponse;
1645
- export type RiskQuestionnaireResponseDto = OpaqueResponse;
2670
+ export interface DevicePublicBrowserDetailsDto {
2671
+ browserName: string;
2672
+ browserMajorVersion: string;
2673
+ browserFullVersion: string;
2674
+ os: 'WINDOWS' | 'MACOS' | 'LINUX' | 'IOS' | 'ANDROID' | 'OTHER';
2675
+ osVersion: string;
2676
+ device: 'DESKTOP' | 'MOBILE' | 'TABLET' | 'UNKNOWN';
2677
+ userAgent: string;
2678
+ }
2679
+ export interface DeviceGeolocationDto {
2680
+ country: string;
2681
+ city: string;
2682
+ /** The observed point. Same numbers as `latitude`/`longitude`, kept paired. */
2683
+ coordinates: CoordinatesDto;
2684
+ latitude: number;
2685
+ longitude: number;
2686
+ timezone: string;
2687
+ accuracyRadius: number;
2688
+ continent?: string;
2689
+ postalCode?: string;
2690
+ }
2691
+ export interface DeviceVpnDetectionMethodsDto {
2692
+ timezoneMismatch: boolean;
2693
+ publicVPN: boolean;
2694
+ auxiliaryMobile: boolean;
2695
+ relay: boolean;
2696
+ }
2697
+ export interface DeviceVpnDetectionDto {
2698
+ result: boolean;
2699
+ confidence: number;
2700
+ originTimezone: string;
2701
+ originCountry: string;
2702
+ methods: DeviceVpnDetectionMethodsDto;
2703
+ }
2704
+ export interface DeviceIpSessionDto {
2705
+ geolocation: DeviceGeolocationDto;
2706
+ vpn: DeviceVpnDetectionDto;
2707
+ isProxy: boolean;
2708
+ isTor: boolean;
2709
+ incognito: boolean;
2710
+ seenAt: string;
2711
+ }
2712
+ /**
2713
+ * A customer linked to a device.
2714
+ *
2715
+ * The dates are the link's own, not the device's: on a device used by more than
2716
+ * one customer they say who had it when.
2717
+ */
2718
+ export interface DeviceCustomerLinkDto {
2719
+ customerId: string;
2720
+ name?: string | null;
2721
+ /** INDIVIDUAL or ENTITY. */
2722
+ type?: string | null;
2723
+ status?: string | null;
2724
+ riskRating?: string | null;
2725
+ externalId?: string | null;
2726
+ firstSeenAt: string;
2727
+ lastSeenAt: string;
2728
+ }
2729
+ /** Safe canonical Device response. It never contains raw fingerprint or IP identity values. */
2730
+ export interface DeviceResponseDto {
2731
+ id: string;
2732
+ requestId?: string | null;
2733
+ browserDetails: DevicePublicBrowserDetailsDto;
2734
+ ipSessions: DeviceIpSessionDto[];
2735
+ botProbability: number;
2736
+ confidence: number;
2737
+ trustLevel: 'KNOWN' | 'NEW' | 'SUSPICIOUS';
2738
+ firstSeenAt: string;
2739
+ lastSeenAt: string;
2740
+ /**
2741
+ * Every customer linked to this device. Returned by `GET /devices/{id}`;
2742
+ * absent on endpoints that list devices in bulk.
2743
+ */
2744
+ customers?: DeviceCustomerLinkDto[];
2745
+ }
2746
+ /** @deprecated Customer Device endpoints now return the canonical Device response. */
2747
+ export type DeviceSummaryDto = DeviceResponseDto;
2748
+ export type CustomerRiskAssessmentResponseDto = OpaqueResponse;
1646
2749
  export type RiskAssessmentResponseDto = OpaqueResponse;
1647
2750
  export type ExpectedActivityResponseDto = OpaqueResponse;
1648
2751
  export type ScreeningResultDto = OpaqueResponse;
1649
2752
  export type ConfirmedMatchDto = OpaqueResponse;
1650
- export type RuleResponseDto = OpaqueResponse;
2753
+ /**
2754
+ * The screening provider's automated false-positive assessment of a weak
2755
+ * match — why the match is, or is not, the customer, decided from date of
2756
+ * birth, geography, role timeline and entity kind rather than from the name.
2757
+ *
2758
+ * Present only where the provider ran it: the customer record carried
2759
+ * attributes to compare against. Absence is not an implied `retain`.
2760
+ *
2761
+ * A `decision` of `discard` sets the match's `disposition` to
2762
+ * `FALSE_POSITIVE` with no human involved — so whenever you see a disposition
2763
+ * none of your users set, `rationale` is the reason.
2764
+ */
2765
+ export interface MatchDisambiguationDto {
2766
+ /**
2767
+ * `discard` where an attribute positively contradicts identity — this is
2768
+ * what auto-dispositions the match. `retain` is the default and is not a
2769
+ * confirmation, only the absence of grounds to eliminate.
2770
+ */
2771
+ decision?: 'discard' | 'retain';
2772
+ /**
2773
+ * How to queue the match. `likely_false_positive` means the evidence
2774
+ * pointed that way but did not clear the provider's confidence floor —
2775
+ * deprioritise, do not dismiss.
2776
+ */
2777
+ dispositionHint?: 'false_positive' | 'likely_false_positive' | 'needs_review' | 'possible_match';
2778
+ /** Confidence in the verdict. A `discard` is only ever emitted at `high`. */
2779
+ confidence?: 'high' | 'medium' | 'low';
2780
+ /**
2781
+ * `hard` for a date-of-birth contradiction, an entity-type mismatch, an
2782
+ * implausible age for the role timeline, or a nationality conflict;
2783
+ * `soft` for jurisdiction or residence geography and gender. A sanctions
2784
+ * listing is never discarded on soft evidence alone.
2785
+ */
2786
+ contradictionStrength?: 'hard' | 'soft' | 'none';
2787
+ /**
2788
+ * The rules that fired, from the provider's closed vocabulary — e.g.
2789
+ * `DOB_CONTRADICTION`, `AGE_IMPLAUSIBLE_FOR_ROLE_TIMELINE`,
2790
+ * `ENTITY_TYPE_MISMATCH`, `NATIONALITY_CONFLICT`, `INSUFFICIENT_DATA_TO_ELIMINATE`.
2791
+ */
2792
+ reasonCodes?: string[];
2793
+ /**
2794
+ * One to three sentences naming the field values compared — the audit
2795
+ * answer to "why was this match eliminated".
2796
+ */
2797
+ rationale?: string;
2798
+ }
2799
+ /**
2800
+ * A single screening match for a customer, read live with its current
2801
+ * disposition. Returned by `GET /v1/customers/{customerId}/screening-results`
2802
+ * — the full true-positive (`CONFIRMED`) / false-positive (`FALSE_POSITIVE`) /
2803
+ * unresolved (`PENDING`) picture. Confirmed and false-positive matches persist
2804
+ * across re-screens.
2805
+ */
2806
+ export interface ScreeningMatchResultDto {
2807
+ /** Match record ID. */
2808
+ id: string;
2809
+ matchType: 'WATCHLIST' | 'HIGH_RISK' | 'CUSTOM_LIST';
2810
+ disposition: 'PENDING' | 'CONFIRMED' | 'FALSE_POSITIVE';
2811
+ /** Matched entity name. */
2812
+ matchedName: string;
2813
+ /** List/source label, e.g. `OFAC SDN` (high-risk → `High Risk`, custom list → list name). */
2814
+ source?: string;
2815
+ /** For CUSTOM_LIST matches: the list's current tags. */
2816
+ listTags?: Array<{
2817
+ value: string;
2818
+ label: string;
2819
+ }>;
2820
+ /**
2821
+ * Short role/bio line. Populated for `HIGH_RISK` (PEP) matches when the
2822
+ * provider supplies one; always present and `""` otherwise — never omitted
2823
+ * or null, so it can be read without a presence check.
2824
+ */
2825
+ tagline: string;
2826
+ /** General free-text profile summary (composed by the screening provider). */
2827
+ summary?: string;
2828
+ /** Provider match confidence, 0–1. */
2829
+ matchConfidence?: number;
2830
+ /** ISO-8601 timestamp the disposition was set. */
2831
+ resolvedAt?: string;
2832
+ /** Who set the disposition. */
2833
+ resolvedBy?: Record<string, unknown>;
2834
+ /**
2835
+ * The provider's automated false-positive assessment, where it ran. When
2836
+ * `disposition` is `FALSE_POSITIVE` and `resolvedBy` is the screening
2837
+ * service rather than one of your users, this is why.
2838
+ */
2839
+ disambiguation?: MatchDisambiguationDto;
2840
+ }
2841
+ /**
2842
+ * A single screening run from
2843
+ * `GET /v1/customers/{customerId}/screening-history[/latest]`. One entry per
2844
+ * time the customer was screened (initial, ongoing, manual, event-triggered).
2845
+ */
2846
+ export interface ScreeningHistoryEntryDto {
2847
+ /** Screening log entry ID. */
2848
+ id: string;
2849
+ customerId: string;
2850
+ customerName: string;
2851
+ /** What triggered the screening, e.g. `INITIAL` | `ONGOING` | `MANUAL` | `EVENT_TRIGGERED`. */
2852
+ screeningType: string;
2853
+ /** Run status, e.g. `COMPLETED` | `PENDING` | `FAILED`. */
2854
+ status: string;
2855
+ /** Total matches surfaced across all sources. */
2856
+ matchesFound: number;
2857
+ /** Number of alerts raised from this screening. */
2858
+ alertsGenerated: number;
2859
+ /** Watchlist matches suppressed by whitelisting/dispositions. */
2860
+ suppressedWatchlistCount: number;
2861
+ /** High-risk/PEP matches suppressed by whitelisting/dispositions. */
2862
+ suppressedHighRiskCount: number;
2863
+ /** Custom-list matches suppressed by prior false-positive dispositions. */
2864
+ suppressedCustomListCount: number;
2865
+ /** Which checks were run, e.g. `['WATCHLIST', 'HIGH_RISK', 'CUSTOM_LIST']`. */
2866
+ checksRun: string[];
2867
+ /** ISO-8601 timestamp the screening was initiated. */
2868
+ createdAt: string;
2869
+ /** ISO-8601 timestamp the screening finished, if completed. */
2870
+ completedAt?: string;
2871
+ [key: string]: unknown;
2872
+ }
2873
+ /**
2874
+ * Options for `individuals.create` / `entities.create`.
2875
+ */
2876
+ export interface CreateCustomerOptions {
2877
+ /**
2878
+ * How the INITIAL screening runs. `async` (default) queues it and the
2879
+ * call returns at once — poll `customers.screening.history` /
2880
+ * `listResults`, or listen for the screening webhooks. `sync` runs it
2881
+ * before responding and returns the run and its matches under
2882
+ * `screening` on the response.
2883
+ */
2884
+ screening?: 'async' | 'sync';
2885
+ }
2886
+ /**
2887
+ * Outcome of the INITIAL screening run performed inline by
2888
+ * `individuals.create(input, { screening: 'sync' })` and the entities twin.
2889
+ */
2890
+ export interface InitialScreeningResultDto {
2891
+ /** Screening log entry ID — the same id `screening.history` returns. */
2892
+ id: string;
2893
+ /** Always `INITIAL` for a create-time run. */
2894
+ screeningType: string;
2895
+ /**
2896
+ * `COMPLETED` when every configured check ran. `FAILED` when no provider
2897
+ * is configured or every provider failed — the customer still exists;
2898
+ * rerun with `customers.screening.trigger(customerId)`.
2899
+ */
2900
+ status: 'COMPLETED' | 'FAILED';
2901
+ /** Why the run FAILED, e.g. `no_providers_configured`, `all_providers_failed`. */
2902
+ statusReason?: string;
2903
+ /** Which checks actually ran, e.g. `['WATCHLIST', 'HIGH_RISK', 'CUSTOM_LIST']`. */
2904
+ checksRun: string[];
2905
+ /** Total matches surfaced across all sources, including auto-dismissed ones. */
2906
+ matchesFound: number;
2907
+ /** Number of alerts raised from this screening (0 or 1). */
2908
+ alertsGenerated: number;
2909
+ /** The screening alert holding these matches, when any were found. Absent on a clear run. */
2910
+ alertId?: string;
2911
+ /**
2912
+ * Matches the provider's attribute assessment eliminated as false
2913
+ * positives. Still counted in `matchesFound` and listed in `matches`
2914
+ * with disposition `FALSE_POSITIVE`.
2915
+ */
2916
+ autoDismissedMatchCount: number;
2917
+ /** True when every match was auto-dismissed and the alert closed itself. */
2918
+ alertAutoClosed: boolean;
2919
+ /** ISO-8601 timestamp the screening was initiated. */
2920
+ createdAt: string;
2921
+ /** ISO-8601 timestamp the screening finished. */
2922
+ completedAt?: string;
2923
+ /**
2924
+ * Every match this run surfaced, with its disposition — the same shape
2925
+ * as `customers.screening.listResults`. Empty on a clear or FAILED run.
2926
+ */
2927
+ matches: ScreeningMatchResultDto[];
2928
+ }
2929
+ /**
2930
+ * `individuals.create` response. Identical to `IndividualResponseDto` unless
2931
+ * the call used `{ screening: 'sync' }`, in which case `screening` carries
2932
+ * the INITIAL run's outcome and matches.
2933
+ */
2934
+ export interface IndividualCreatedResponseDto extends IndividualResponseDto {
2935
+ screening?: InitialScreeningResultDto;
2936
+ }
2937
+ /** `entities.create` response — see `IndividualCreatedResponseDto`. */
2938
+ export interface EntityCreatedResponseDto extends EntityResponseDto {
2939
+ screening?: InitialScreeningResultDto;
2940
+ }
2941
+ /** KYC verification status, mirroring the backend `KYCVerificationStatus` enum. */
2942
+ export type KycVerificationStatus = 'VERIFIED' | 'FAILED' | 'PENDING' | 'EXPIRED';
2943
+ /**
2944
+ * Result of starting a KYC session
2945
+ * (`POST /v1/customers/{customerId}/kyc/sessions`). Hand `sessionUrl` to the
2946
+ * customer to complete verification.
2947
+ */
2948
+ export interface StartKycSessionResponseDto {
2949
+ /** Local KYC session id. */
2950
+ sessionId: string;
2951
+ /** The provider's own session id. */
2952
+ providerSessionId: string;
2953
+ /** Hosted URL the customer visits to complete verification. */
2954
+ sessionUrl: string;
2955
+ status: KycVerificationStatus;
2956
+ /** ISO-8601 expiry, or null. */
2957
+ expiresAt?: string | null;
2958
+ /** ISO-8601 creation time. */
2959
+ createdAt: string;
2960
+ }
2961
+ /**
2962
+ * A persisted KYC session, returned by
2963
+ * `GET /v1/customers/{customerId}/kyc/sessions` and the refresh endpoint.
2964
+ */
2965
+ export interface KycSessionDto {
2966
+ id: string;
2967
+ customerId: string;
2968
+ status: KycVerificationStatus;
2969
+ /** Which provider ran the session, e.g. `dossiers`. */
2970
+ provider?: string | null;
2971
+ /** Hosted URL the customer visits to complete verification. */
2972
+ sessionUrl?: string | null;
2973
+ /** Per-step verification progress (provider-normalized). */
2974
+ steps: Record<string, unknown>[];
2975
+ /** Verified identity documents (provider-normalized). */
2976
+ documents: Record<string, unknown>[];
2977
+ overallResult?: string | null;
2978
+ /** ISO-8601 expiry, or null. */
2979
+ expiresAt?: string | null;
2980
+ /** ISO-8601 creation time. */
2981
+ createdAt: string;
2982
+ /** ISO-8601 completion time, if completed. */
2983
+ completedAt?: string | null;
2984
+ [key: string]: unknown;
2985
+ }
2986
+ /**
2987
+ * A saved rule as returned by the Config — Rules API
2988
+ * (`POST`/`GET`/`PATCH /v1/config/rules[/:id]`). Mirrors the backend
2989
+ * `RULE_SCHEMA`.
2990
+ */
2991
+ export interface RuleResponseDto {
2992
+ id: string;
2993
+ name: string;
2994
+ description?: string;
2995
+ /** Rule subject: 'TRANSACTION' | 'EVENT' | 'CUSTOMER' | 'ALL'. */
2996
+ subject: string;
2997
+ /** Rule trigger — see CreateRuleDto.trigger. */
2998
+ trigger: string;
2999
+ severity: 'HIGH' | 'MEDIUM' | 'LOW';
3000
+ status: 'DRAFT' | 'ACTIVE' | 'DISABLED';
3001
+ tags: string[];
3002
+ /** Condition tree (AND/OR logic with leaf conditions). */
3003
+ conditionTree: Record<string, unknown>;
3004
+ /** Actions to execute when the rule triggers. */
3005
+ actions: Record<string, unknown>[];
3006
+ /** Window period for aggregate conditions. */
3007
+ windowPeriod?: string;
3008
+ /** Sync key for config-as-code management. */
3009
+ syncKey?: string;
3010
+ isSystemRule: boolean;
3011
+ /** Product applicability. Null / empty products = unscoped. */
3012
+ scope?: {
3013
+ products?: string[];
3014
+ } | null;
3015
+ createdAt: string;
3016
+ updatedAt: string;
3017
+ }
3018
+ /**
3019
+ * A single immutable rule version snapshot from
3020
+ * GET /v1/config/rules/{id}/versions[/{version}]. Carries the definitional
3021
+ * fields plus audit metadata (version, changeKind, changeNote, actor, createdAt).
3022
+ */
3023
+ export type RuleVersionResponseDto = OpaqueResponse;
3024
+ /** Response from GET /v1/config/rules/:id/analytics — disposition breakdown + precision (#42). */
3025
+ export type RuleAnalyticsResponseDto = OpaqueResponse;
3026
+ /** Input for POST /v1/config/rules/backtest (spec v0 rules §11 + synthetic source). */
3027
+ export interface SimulateRulesDto {
3028
+ /** Default HISTORICAL. */
3029
+ source?: 'HISTORICAL' | 'SYNTHETIC';
3030
+ /** Existing rules to simulate; conditionTreeOverride A/B-tests changes without saving. */
3031
+ rules?: Array<{
3032
+ ruleId: string;
3033
+ conditionTreeOverride?: Record<string, unknown>;
3034
+ }>;
3035
+ /** Inline unsaved rules — evaluated only for this run. */
3036
+ adHocRules?: Array<{
3037
+ name: string;
3038
+ severity: string;
3039
+ conditionTree: Record<string, unknown>;
3040
+ }>;
3041
+ period: {
3042
+ from: string;
3043
+ to: string;
3044
+ };
3045
+ filters?: {
3046
+ customerIds?: string[];
3047
+ accountIds?: string[];
3048
+ modeCategories?: string[];
3049
+ minAmountMinor?: number;
3050
+ };
3051
+ /** Cap on transactions evaluated (default 5000, max 100000). */
3052
+ maxTransactions?: number;
3053
+ /** Generator parameters (SYNTHETIC source only). */
3054
+ synthetic?: {
3055
+ count?: number;
3056
+ customerIds?: string[];
3057
+ minAmountMinor?: number;
3058
+ maxAmountMinor?: number;
3059
+ modeCategories?: string[];
3060
+ directions?: string[];
3061
+ /**
3062
+ * Event occurrences to generate across the period (default one per 20
3063
+ * transactions, max 500). Events that typically precede activity pull a
3064
+ * run of transactions in behind them.
3065
+ */
3066
+ eventCount?: number;
3067
+ /** Event Definition names to draw from. Default: the org's active definitions. */
3068
+ eventTypes?: string[];
3069
+ };
3070
+ includeMatches?: boolean;
3071
+ }
3072
+ /** Dry-run simulation report — nothing was persisted, no actions executed. */
3073
+ export interface SimulationReportDto {
3074
+ simulationId: string;
3075
+ source: 'HISTORICAL' | 'SYNTHETIC';
3076
+ dryRun: true;
3077
+ periodFrom: string;
3078
+ periodTo: string;
3079
+ transactionsEvaluated: number;
3080
+ totalMatches: number;
3081
+ executionTimeMs: number;
3082
+ /** Tenant base currency (TYPE:CODE) that per-rule matched volumes are denominated in. */
3083
+ baseCurrency: string;
3084
+ byRule: Array<{
3085
+ ruleId: string;
3086
+ ruleName: string;
3087
+ severity: string;
3088
+ matchCount: number;
3089
+ distinctCustomers: number;
3090
+ distinctAccounts: number;
3091
+ totalMatchedVolumeMinor: number;
3092
+ matches: Array<{
3093
+ transactionId: string;
3094
+ /** Internal transactions.id — null for synthetic rows (nothing stored). */
3095
+ transactionDbId: string | null;
3096
+ customerId: string | null;
3097
+ bookedAt: string;
3098
+ baseAmountMinor: number | null;
3099
+ /** Currency of `baseAmountMinor` (TYPE:CODE) — pair these when formatting. */
3100
+ baseCurrency: string | null;
3101
+ /** Minor-unit precision of `baseCurrency`. */
3102
+ basePrecision: number | null;
3103
+ originCurrency: string | null;
3104
+ flagReasons: string[];
3105
+ wouldHaveExecuted: Array<Record<string, unknown>>;
3106
+ /** Full transaction snapshot (mode, status, monetary legs, parties, metadata). */
3107
+ transactionDetail: Record<string, unknown>;
3108
+ }>;
3109
+ }>;
3110
+ /** Synthetic Events generated for the period, and the activity behind them. */
3111
+ syntheticEvents: Array<{
3112
+ /** Event Definition name the occurrences were generated from. */
3113
+ type: string;
3114
+ count: number;
3115
+ /** Synthetic transactions clustered in the window behind these events. */
3116
+ followedByTransactions: number;
3117
+ }>;
3118
+ coverageGaps: string[];
3119
+ warnings: string[];
3120
+ }
1651
3121
  export type ConstantResponseDto = OpaqueResponse;
1652
- export type ProductResponseDto = OpaqueResponse;
1653
- export type CurrencyResponseDto = OpaqueResponse;
3122
+ export interface ProductResponseDto {
3123
+ id: string;
3124
+ externalId: string;
3125
+ name: string;
3126
+ description?: string | null;
3127
+ category: AccountCategory;
3128
+ tags: TagValue[];
3129
+ /** @deprecated Use `tags`. Retained for API compatibility. */
3130
+ baseType: AccountType;
3131
+ status: ProductStatus;
3132
+ defaultCurrency: string;
3133
+ /** @deprecated Use `tags` when product classification is needed. */
3134
+ country?: string | null;
3135
+ supportedMethodIds: string[];
3136
+ accountFieldConfig?: TypedFieldDefinition[];
3137
+ /** @deprecated Use `accountFieldConfig`. */
3138
+ typedAccountFieldConfig?: TypedFieldDefinition[];
3139
+ fields?: TypedFieldValueInput[];
3140
+ otherProperties?: UntypedKeyValueInput[];
3141
+ syncKey?: string | null;
3142
+ createdAt: string;
3143
+ updatedAt: string;
3144
+ }
3145
+ export interface CurrencyResponseDto {
3146
+ id: string;
3147
+ type: CurrencyType;
3148
+ code: string;
3149
+ /** Composite identifier in TYPE:CODE form (e.g. FIAT:USD). */
3150
+ currencyId: string;
3151
+ /** Number of minor-unit decimal places. */
3152
+ precision: number;
3153
+ name: string;
3154
+ symbol: string;
3155
+ isEnabled: boolean;
3156
+ isCustom: boolean;
3157
+ createdAt: string;
3158
+ updatedAt: string;
3159
+ }
1654
3160
  export type EventDefinitionResponseDto = OpaqueResponse;
1655
3161
  export type WebhookResponseDto = OpaqueResponse;
1656
- export type SyncExportDto = OpaqueResponse;
1657
3162
  export interface SyncSnapshotActor {
1658
3163
  userId: string;
1659
3164
  name: string;
@@ -1677,9 +3182,1132 @@ export interface SyncDriftDto {
1677
3182
  export interface CreateSyncSnapshotInput {
1678
3183
  note?: string;
1679
3184
  }
1680
- export type ResetConfigResponseDto = OpaqueResponse;
1681
- export type PushExchangeRatesResponseDto = OpaqueResponse;
1682
- export type BulkCurrencyStatusResponseDto = OpaqueResponse;
1683
- /** Bulk update body for `PATCH /v1/config/currencies/bulk-status` (schema undocumented). */
1684
- export type BulkCurrencyStatusInput = Record<string, unknown>;
3185
+ export interface SyncConfig {
3186
+ $schema?: string;
3187
+ version: number;
3188
+ tenant: {
3189
+ organizationId: string;
3190
+ baseCurrency?: string;
3191
+ displayName?: string;
3192
+ };
3193
+ productDefinitions?: Record<string, SyncProductDefinitionConfig | string>;
3194
+ constants?: Record<string, SyncConstantConfig>;
3195
+ eventDefinitions?: Record<string, SyncEventDefConfig>;
3196
+ webhooks?: Record<string, SyncWebhookConfig>;
3197
+ rules?: Record<string, SyncRuleConfig>;
3198
+ /** Keyed by TYPE:CODE (e.g. "FIAT:USD", "CRYPTO:BTC"). */
3199
+ currencies?: Record<string, SyncCurrencyConfig>;
3200
+ /**
3201
+ * Tag catalogue vocabulary — keyed by `<fieldKey>:<value>` (e.g.
3202
+ * "rule.tags:high-risk"). Unlike the other sections, an ABSENT section is
3203
+ * "unmanaged", not "empty": omitting it never retires live tags.
3204
+ */
3205
+ tagCatalogue?: Record<string, SyncTagCatalogueEntryConfig>;
3206
+ /**
3207
+ * Tag groups — keyed `<fieldKey>:<groupValue>` (e.g.
3208
+ * "customer.tags:primary-branch"). Same "absent means unmanaged" rule as
3209
+ * `tagCatalogue`, and applied BEFORE it so a namespaced tag can resolve
3210
+ * the group that owns it.
3211
+ */
3212
+ tagGroups?: Record<string, SyncTagGroupConfig>;
3213
+ /**
3214
+ * @deprecated Retired. Assignment policies were replaced by alert
3215
+ * workflows; the server rejects a bundle whose `assignmentPolicies`
3216
+ * section is non-empty. Configure stage assignment through
3217
+ * `config.alertWorkflows` instead.
3218
+ */
3219
+ assignmentPolicies?: Record<string, SyncAssignmentPolicyConfig>;
3220
+ /**
3221
+ * Tenant-wide attempt retention/coverage. Absent means unmanaged and
3222
+ * supplied fields update only those values.
3223
+ */
3224
+ behaviorSettings?: SyncBehaviorSettingsConfig;
3225
+ customerFieldPolicy?: Record<string, SyncCustomerFieldPolicyConfig>;
3226
+ accountStatusPolicy?: SyncAccountStatusPolicyConfig;
3227
+ }
3228
+ export interface SyncBehaviorSettingsConfig {
3229
+ attemptRetentionDays?: number;
3230
+ attemptCoverage?: 'ALL' | 'SELECTIVE';
3231
+ unknownEventTypes?: 'ACCEPT' | 'REJECT';
3232
+ }
3233
+ /**
3234
+ * Assignment policy (screening-alert auto-assignment routing). Targets are
3235
+ * org-local better-auth user ids / domain team uuids, validated against
3236
+ * membership on apply.
3237
+ *
3238
+ * @deprecated Retired with `SyncConfig.assignmentPolicies`; the server
3239
+ * rejects a non-empty section. Use `config.alertWorkflows`.
3240
+ */
3241
+ export interface SyncAssignmentPolicyConfig {
3242
+ name: string;
3243
+ description?: string;
3244
+ /** Default true. */
3245
+ enabled?: boolean;
3246
+ /** Evaluation order, ascending. First match wins. Must be unique per config. */
3247
+ priority: number;
3248
+ /** Qualifier tree; `{logic:'AND', conditions:[]}` = catch-all. */
3249
+ conditionTree: AssignmentPolicyConditionGroup;
3250
+ /** STATIC (default): fixed targets. TAG_MAP: route by `tagMap`. */
3251
+ targetMode?: AssignmentTargetMode;
3252
+ tagMap?: AssignmentPolicyTagMap;
3253
+ assignToUserIds?: string[];
3254
+ assignToTeamIds?: string[];
3255
+ }
3256
+ export interface SyncTagCatalogueEntryConfig {
3257
+ /** Human-readable display label. The value slug lives in the section key. */
3258
+ label: string;
3259
+ /** Fixed palette token (e.g. `neutral`, `red`, `blue`), not a hex value. */
3260
+ color?: string;
3261
+ description?: string;
3262
+ /**
3263
+ * Owning group's slug, unqualified (e.g. `primary-branch`). When set, the
3264
+ * section key must already carry the namespace:
3265
+ * `<fieldKey>:<group>:<tag>`.
3266
+ */
3267
+ group?: string;
3268
+ }
3269
+ export interface SyncTagGroupConfig {
3270
+ /** Human-readable display label. The namespace slug lives in the section key. */
3271
+ label: string;
3272
+ description?: string;
3273
+ color?: string;
3274
+ /** `SINGLE` allows one member tag per record. Defaults to `MULTI`. */
3275
+ cardinality?: TagGroupCardinality;
3276
+ sortOrder?: number;
3277
+ }
3278
+ export interface SyncCurrencyConfig {
3279
+ name: string;
3280
+ symbol?: string;
3281
+ precision: number;
3282
+ enabled?: boolean;
3283
+ custom?: boolean;
3284
+ }
3285
+ export interface SyncConstantConfig {
3286
+ type: 'scalar' | 'monetary' | 'set' | 'range' | 'text' | 'number' | 'boolean' | 'date' | 'currency' | 'regex';
3287
+ description: string;
3288
+ values?: string[];
3289
+ value?: string | number | boolean | null;
3290
+ min?: number;
3291
+ max?: number;
3292
+ }
3293
+ export interface SyncProductDefinitionConfig {
3294
+ name: string;
3295
+ description?: string;
3296
+ category: string;
3297
+ /** Plain tag labels governed by the `product.tags` catalogue. */
3298
+ tags?: string[];
3299
+ /** @deprecated Use `tags`. Omitted values are persisted as `OTHER`. */
3300
+ baseType?: string;
3301
+ defaultCurrency: string;
3302
+ /** @deprecated Use `tags` when product classification is needed. */
3303
+ country?: string;
3304
+ supportedMethods: string[];
3305
+ /** Account field template inherited by accounts created from this product. */
3306
+ accountFieldConfig?: TypedFieldDefinition[];
3307
+ metadata?: Record<string, unknown>;
3308
+ }
3309
+ export interface SyncEventDefConfig {
3310
+ name: string;
3311
+ description: string;
3312
+ subject: 'CUSTOMER' | 'ACCOUNT' | 'TRANSACTION';
3313
+ }
3314
+ export interface SyncWebhookConfig {
3315
+ description: string;
3316
+ url: string;
3317
+ headers?: Record<string, string>;
3318
+ events: string[];
3319
+ }
3320
+ export interface SyncRuleConfig {
3321
+ name: string;
3322
+ description: string;
3323
+ subject: string;
3324
+ trigger: string;
3325
+ severity: 'HIGH' | 'MEDIUM' | 'LOW';
3326
+ tags?: string[];
3327
+ conditionTree: unknown;
3328
+ actions?: RuleAction[];
3329
+ initialStatus?: 'DRAFT' | 'ACTIVE' | 'DISABLED';
3330
+ status?: 'DRAFT' | 'ACTIVE' | 'DISABLED';
3331
+ }
3332
+ export interface SyncCustomerFieldPolicyConfig {
3333
+ source: string;
3334
+ syncTrigger: string;
3335
+ usedBy: string[];
3336
+ }
3337
+ export interface SyncAccountStatusPolicyConfig {
3338
+ statuses: string[];
3339
+ dormancyThresholdDays?: number;
3340
+ dormancyStrategy?: 'MANUAL' | 'AUTO';
3341
+ usedBy?: Record<string, string[]>;
3342
+ }
3343
+ /** Request body for `validate` / `plan` / `apply`. */
3344
+ export interface SyncConfigBody {
3345
+ config: SyncConfig;
3346
+ }
3347
+ export type SyncDiffOpType = 'create' | 'update' | 'destroy' | 'archive' | 'tombstone';
3348
+ export interface SyncDiffOp {
3349
+ type: SyncDiffOpType;
3350
+ key: string;
3351
+ config?: unknown;
3352
+ changes?: string[];
3353
+ }
3354
+ export interface SyncImmutableViolation {
3355
+ section: string;
3356
+ key: string;
3357
+ field: string;
3358
+ liveValue: unknown;
3359
+ configValue: unknown;
3360
+ }
3361
+ export interface SyncPlan {
3362
+ products: SyncDiffOp[];
3363
+ constants: SyncDiffOp[];
3364
+ eventDefs: SyncDiffOp[];
3365
+ webhooks: SyncDiffOp[];
3366
+ rules: SyncDiffOp[];
3367
+ currencies: SyncDiffOp[];
3368
+ tagGroups: SyncDiffOp[];
3369
+ tagCatalogue: SyncDiffOp[];
3370
+ assignmentPolicies: SyncDiffOp[];
3371
+ behaviorSettings: SyncDiffOp[];
3372
+ immutableViolations: SyncImmutableViolation[];
3373
+ }
3374
+ /** `POST /v1/config/sync/validate` response. */
3375
+ export interface SyncValidationResult {
3376
+ errors: string[];
3377
+ warnings: string[];
3378
+ }
3379
+ /** `POST /v1/config/sync/plan` response (validation + advisory diff). */
3380
+ export interface SyncPlanResult extends SyncValidationResult {
3381
+ plan: SyncPlan;
3382
+ }
3383
+ export interface SyncApplyResultItem {
3384
+ section: string;
3385
+ key: string;
3386
+ type: SyncDiffOpType;
3387
+ status: 'applied' | 'failed';
3388
+ error?: string;
3389
+ }
3390
+ /** `POST /v1/config/sync/apply` response. */
3391
+ export interface SyncApplyResult {
3392
+ succeeded: number;
3393
+ failed: number;
3394
+ results: SyncApplyResultItem[];
3395
+ immutableViolations: SyncImmutableViolation[];
3396
+ }
3397
+ export interface SyncExportQuery {
3398
+ /** Include rows without a sync key (keyed by natural id). Used by import/pull. */
3399
+ includeUnsynced?: boolean;
3400
+ }
3401
+ export type ResetConfigResponseDto = OpaqueResponse;
3402
+ export type PushExchangeRatesResponseDto = OpaqueResponse;
3403
+ export interface BulkCurrencyStatusResponseDto {
3404
+ updatedCount: number;
3405
+ }
3406
+ /** Bulk update body for `PATCH /v1/config/currencies/bulk-status`. */
3407
+ export interface BulkCurrencyStatusInput {
3408
+ ids: string[];
3409
+ enabled: boolean;
3410
+ }
3411
+ /** Catalogue-governed tag: slugified `value` + human-readable `label`. */
3412
+ export interface CustomListTagValue {
3413
+ value: string;
3414
+ label: string;
3415
+ }
3416
+ /** Offset pagination meta returned by the custom-lists list endpoints. */
3417
+ export interface CustomListPageMeta {
3418
+ page: number;
3419
+ pageSize: number;
3420
+ totalItems: number;
3421
+ totalPages: number;
3422
+ hasNextPage: boolean;
3423
+ hasPreviousPage: boolean;
3424
+ }
3425
+ /**
3426
+ * A tenant-managed screening list. Enabled LIVE lists are checked by every
3427
+ * screening run (initial, ongoing, manual, ad-hoc search) alongside external
3428
+ * providers; the list's tags are shown against every match it produces.
3429
+ */
3430
+ export interface CustomScreeningListDto {
3431
+ id: string;
3432
+ name: string;
3433
+ description?: string | null;
3434
+ /** Disabled lists are skipped by screening but stay editable. */
3435
+ enabled: boolean;
3436
+ tags: CustomListTagValue[];
3437
+ entryCount: number;
3438
+ /** `LIVE` | `ARCHIVED`. Archived lists are read-only and never screened. */
3439
+ lifecycle: string;
3440
+ archivedAt?: string | null;
3441
+ createdAt: string;
3442
+ updatedAt: string;
3443
+ }
3444
+ export interface CustomListEntryDto {
3445
+ id: string;
3446
+ listId: string;
3447
+ name: string;
3448
+ entryType: 'INDIVIDUAL' | 'ENTITY';
3449
+ aliases: string[];
3450
+ /** YYYY-MM-DD. */
3451
+ dateOfBirth?: string | null;
3452
+ /** ISO 3166-1 alpha-3 country code. */
3453
+ country?: string | null;
3454
+ idNumber?: string | null;
3455
+ notes?: string | null;
3456
+ /** Caller identifier; bulk imports upsert rows carrying the same externalRef. */
3457
+ externalRef?: string | null;
3458
+ createdAt: string;
3459
+ updatedAt: string;
3460
+ }
3461
+ export interface CreateCustomScreeningListInput {
3462
+ name: string;
3463
+ description?: string;
3464
+ /** Defaults to true. */
3465
+ enabled?: boolean;
3466
+ tags?: CustomListTagValue[];
3467
+ }
3468
+ export interface UpdateCustomScreeningListInput {
3469
+ name?: string;
3470
+ description?: string;
3471
+ enabled?: boolean;
3472
+ tags?: CustomListTagValue[];
3473
+ }
3474
+ export interface CustomListEntryInput {
3475
+ name: string;
3476
+ /** Defaults to INDIVIDUAL. */
3477
+ entryType?: 'INDIVIDUAL' | 'ENTITY';
3478
+ aliases?: string[];
3479
+ /** YYYY-MM-DD. */
3480
+ dateOfBirth?: string;
3481
+ /** ISO 3166-1 alpha-3 country code. */
3482
+ country?: string;
3483
+ idNumber?: string;
3484
+ notes?: string;
3485
+ externalRef?: string;
3486
+ }
3487
+ export type UpdateCustomListEntryInput = Partial<CustomListEntryInput>;
3488
+ /** One rejected row from a bulk import, with the zero-based batch index. */
3489
+ export interface BulkCustomListImportRejectedRow {
3490
+ index: number;
3491
+ reason: string;
3492
+ name?: string | null;
3493
+ }
3494
+ /**
3495
+ * Result of a bulk entry import. The request succeeds even with rejections —
3496
+ * invalid rows are reported per-row instead of failing the batch.
3497
+ */
3498
+ export interface BulkCustomListImportResultDto {
3499
+ createdCount: number;
3500
+ updatedCount: number;
3501
+ rejectedCount: number;
3502
+ rejected: BulkCustomListImportRejectedRow[];
3503
+ }
3504
+ export interface CustomScreeningListListResponse {
3505
+ data: CustomScreeningListDto[];
3506
+ meta: CustomListPageMeta;
3507
+ }
3508
+ export interface CustomListEntryListResponse {
3509
+ data: CustomListEntryDto[];
3510
+ meta: CustomListPageMeta;
3511
+ }
3512
+ export interface AssignmentPolicyConditionLeaf {
3513
+ /** Qualifier field key (e.g. `customer.riskRating`, `screening.type`). */
3514
+ field: string;
3515
+ /** Operator from the rules-engine matrix (e.g. `=`, `IN`, `CONTAINS_ANY`, `>`). */
3516
+ operator: string;
3517
+ /** Comparison value. Omitted for null-aware operators (IS_NULL, IS_EMPTY, …). */
3518
+ value?: string;
3519
+ /** Result when the field resolves null under a non-null-aware operator. Default 'FALSE'. */
3520
+ whenMissing?: 'TRUE' | 'FALSE';
3521
+ }
3522
+ export interface AssignmentPolicyConditionGroup {
3523
+ logic: 'AND' | 'OR' | 'NOT';
3524
+ conditions: (AssignmentPolicyConditionLeaf | AssignmentPolicyConditionGroup)[];
3525
+ }
3526
+ export type AssignmentTargetMode = 'STATIC' | 'TAG_MAP';
3527
+ export interface AssignmentPolicyTagMapEntry {
3528
+ /** Catalogue value slug this entry routes (e.g. "branch-colombo-01"). */
3529
+ tag: string;
3530
+ assignToUserIds?: string[];
3531
+ assignToTeamIds?: string[];
3532
+ }
3533
+ /**
3534
+ * TAG_MAP routing table: routes by the customer's tag values (branch
3535
+ * workflow — one policy covers any number of branch→team mappings).
3536
+ * Entries are ordered; for a customer carrying several mapped values the
3537
+ * FIRST matching entry wins. No entry matching → the policy does not match
3538
+ * and evaluation falls through to the next one.
3539
+ */
3540
+ /** @deprecated Superseded by {@link AssignmentRouting}, which supports several blocks per policy. */
3541
+ export interface AssignmentPolicyTagMap {
3542
+ field: 'customer.tags' | 'customer.activeRiskTags' | 'customer.country';
3543
+ /**
3544
+ * Tag group whose membership this table routes, e.g. `primary-branch`.
3545
+ * When set, every entry's `tag` must be a member of that group — that is,
3546
+ * namespaced as `primary-branch:…` — and the server rejects the write
3547
+ * otherwise. Not consulted at match time; it exists so a row that could
3548
+ * never match is caught on save instead of failing silently forever.
3549
+ *
3550
+ * Null / omitted for a table over ungrouped tags, and required to be null
3551
+ * for `customer.country`, which has no tag catalogue.
3552
+ */
3553
+ groupValue?: string | null;
3554
+ entries: AssignmentPolicyTagMapEntry[];
3555
+ }
3556
+ /**
3557
+ * How a policy resolves its targets, when not the fixed
3558
+ * `assignToUserIds` / `assignToTeamIds`. Exactly ONE of these — anything more
3559
+ * (ordering, cross-field matching) is expressed as additional policies with
3560
+ * their own qualifiers, which is what the policy list already does.
3561
+ *
3562
+ * Supersedes {@link AssignmentPolicyTagMap}. A policy written before this
3563
+ * existed is served here in the current shape, so clients read one thing.
3564
+ */
3565
+ export type AssignmentRouting = {
3566
+ /**
3567
+ * Route to whoever is standing-assigned the customer. Carries no
3568
+ * targets of its own — they come from the customer record, so this
3569
+ * can replace a per-branch routing table entirely.
3570
+ *
3571
+ * Does NOT match an unassigned customer: the alert falls through to
3572
+ * the next policy.
3573
+ */
3574
+ kind: 'CUSTOMER_ASSIGNEE';
3575
+ /** Which side of the assignment to use. Default BOTH. */
3576
+ use?: 'BOTH' | 'TEAMS' | 'USERS' | null;
3577
+ } | {
3578
+ /** Look the customer up in one tag group's table; first match wins. */
3579
+ kind: 'TAG_GROUP';
3580
+ field: 'customer.tags' | 'customer.activeRiskTags' | 'customer.country';
3581
+ /**
3582
+ * Tag group whose membership this table routes. Every entry must be a
3583
+ * member (`primary-branch:…`), or the write is rejected. Null routes
3584
+ * ungrouped values, or country, which has no catalogue.
3585
+ */
3586
+ groupValue?: string | null;
3587
+ entries: AssignmentPolicyTagMapEntry[];
3588
+ };
3589
+ export interface AssignmentPolicyResponseDto {
3590
+ id: string;
3591
+ name: string;
3592
+ description: string | null;
3593
+ enabled: boolean;
3594
+ /** Evaluation order, ascending. First match wins. */
3595
+ priority: number;
3596
+ /** Qualifier tree. `{logic:'AND', conditions:[]}` = catch-all. */
3597
+ conditionTree: AssignmentPolicyConditionGroup;
3598
+ /** STATIC: fixed targets. TAG_MAP: routed via `routing`. */
3599
+ targetMode: AssignmentTargetMode;
3600
+ /** @deprecated Read `routing`. Null on anything saved since blocks landed. */
3601
+ tagMap: AssignmentPolicyTagMap | null;
3602
+ /** TAG_MAP: the ordered routing blocks. Legacy rows are served as one block. */
3603
+ routing: AssignmentRouting | null;
3604
+ assignToUserIds: string[];
3605
+ assignToTeamIds: string[];
3606
+ syncKey: string | null;
3607
+ createdAt: string;
3608
+ updatedAt: string;
3609
+ }
3610
+ export interface CreateAssignmentPolicyDto {
3611
+ name: string;
3612
+ description?: string | null;
3613
+ /** Default true. */
3614
+ enabled?: boolean;
3615
+ /** Omitted = catch-all. */
3616
+ conditionTree?: AssignmentPolicyConditionGroup;
3617
+ /** Default STATIC. TAG_MAP requires `routing` and ignores the static targets. */
3618
+ targetMode?: AssignmentTargetMode;
3619
+ routing?: AssignmentRouting | null;
3620
+ /** STATIC mode: at least one user or team target is required. */
3621
+ assignToUserIds?: string[];
3622
+ assignToTeamIds?: string[];
3623
+ syncKey?: string | null;
3624
+ }
3625
+ export interface UpdateAssignmentPolicyDto {
3626
+ name?: string;
3627
+ description?: string | null;
3628
+ enabled?: boolean;
3629
+ conditionTree?: AssignmentPolicyConditionGroup;
3630
+ targetMode?: AssignmentTargetMode;
3631
+ routing?: AssignmentRouting | null;
3632
+ assignToUserIds?: string[];
3633
+ assignToTeamIds?: string[];
3634
+ }
3635
+ export interface ReorderAssignmentPoliciesDto {
3636
+ /** Complete permutation of the org's policy ids in the desired evaluation order. */
3637
+ orderedIds: string[];
3638
+ }
3639
+ export interface TeamRefDto {
3640
+ teamId: string;
3641
+ name: string;
3642
+ memberCount: number;
3643
+ /** Catalogue-governed tags (`team.tags`). */
3644
+ tags: TagValue[];
3645
+ }
3646
+ export interface TeamMemberDto {
3647
+ userId: string;
3648
+ name: string;
3649
+ email?: string;
3650
+ role?: string;
3651
+ avatar?: string;
3652
+ }
3653
+ export interface TeamDto {
3654
+ id: string;
3655
+ name: string;
3656
+ description?: string | null;
3657
+ archivedAt?: string | null;
3658
+ /** Catalogue-governed tags (`team.tags`). */
3659
+ tags: TagValue[];
3660
+ memberCount: number;
3661
+ members: TeamMemberDto[];
3662
+ createdAt: string;
3663
+ updatedAt: string;
3664
+ }
3665
+ export interface CreateTeamDto {
3666
+ name: string;
3667
+ description?: string | null;
3668
+ /** Initial members (better-auth user ids). Each must be a member of the organization. */
3669
+ memberUserIds?: string[];
3670
+ /**
3671
+ * Catalogue-governed tags (`team.tags`). Every value must already exist in
3672
+ * the org tag catalogue — the catalogue is closed.
3673
+ */
3674
+ tags?: TagValueInput[];
3675
+ }
3676
+ export interface UpdateTeamDto {
3677
+ name?: string;
3678
+ description?: string | null;
3679
+ /**
3680
+ * Replaces the full tag set — send every tag the team should end up with,
3681
+ * not a delta. Omit to leave the tags unchanged; pass `[]` to clear them.
3682
+ */
3683
+ tags?: TagValueInput[];
3684
+ }
3685
+ export interface TeamMemberIdsDto {
3686
+ userIds: string[];
3687
+ }
3688
+ /** An array with at least one item. */
3689
+ export type NonEmptyArray<T> = [T, ...T[]];
3690
+ /**
3691
+ * Assignment targets. The API rejects a request unless at least one target
3692
+ * array is present and non-empty.
3693
+ */
3694
+ export type CustomerAssignmentInput = {
3695
+ userIds: NonEmptyArray<string>;
3696
+ teamIds?: string[];
3697
+ } | {
3698
+ userIds?: string[];
3699
+ teamIds: NonEmptyArray<string>;
3700
+ };
3701
+ /**
3702
+ * Bulk assignment preflight-validates every customer and target before
3703
+ * assignment begins.
3704
+ */
3705
+ export type BulkCustomerAssignmentInput = CustomerAssignmentInput & {
3706
+ customerIds: NonEmptyArray<string>;
3707
+ };
3708
+ export interface CustomerAssignmentResponse {
3709
+ id: string;
3710
+ assignedToUserIds: string[];
3711
+ assignedToTeamIds: string[];
3712
+ }
3713
+ export interface BulkCustomerAssignmentResult {
3714
+ /** How many customers actually changed. Already-assigned targets are skipped. */
3715
+ updated: number;
3716
+ }
3717
+ /** @deprecated Use `CustomerAssignmentInput`. */
3718
+ export type CustomerAssignmentDto = CustomerAssignmentInput;
3719
+ /** @deprecated Use `BulkCustomerAssignmentInput`. */
3720
+ export type BulkCustomerAssignmentDto = BulkCustomerAssignmentInput;
3721
+ /** @deprecated Use `CustomerAssignmentResponse`. */
3722
+ export type CustomerAssignmentResponseDto = CustomerAssignmentResponse;
3723
+ /** @deprecated Use `BulkCustomerAssignmentResult`. */
3724
+ export type BulkAssignResultDto = BulkCustomerAssignmentResult;
3725
+ export type * from './alert-workflow-types';
3726
+ export interface AlertWorkflowSettings {
3727
+ id: string;
3728
+ name: string;
3729
+ alertType: import('./alert-workflow-types').WorkflowAlertType;
3730
+ revision: number;
3731
+ publishedVersion: number;
3732
+ draft: import('./alert-workflow-types').WorkflowDefinition;
3733
+ published: import('./alert-workflow-types').WorkflowPublication | null;
3734
+ }
3735
+ export interface SaveAlertWorkflowInput {
3736
+ id?: string;
3737
+ name: string;
3738
+ expectedRevision: number;
3739
+ definition: import('./alert-workflow-types').WorkflowDefinition;
3740
+ publish: boolean;
3741
+ }
3742
+ /** Organization-wide creation experience. Existing alerts retain their saved behavior. */
3743
+ export type AlertWorkflowExperience = 'SIMPLE' | 'DEFINED';
3744
+ export interface AlertWorkflowExperienceSettings {
3745
+ id: string;
3746
+ experience: AlertWorkflowExperience;
3747
+ revision: number;
3748
+ }
3749
+ export interface SaveAlertWorkflowExperienceInput {
3750
+ experience: AlertWorkflowExperience;
3751
+ expectedRevision: number;
3752
+ }
3753
+ /** Published workflow snapshot. Older entries may lack a recoverable definition. */
3754
+ export interface AlertWorkflowVersion {
3755
+ id: string;
3756
+ version: number;
3757
+ isCurrent: boolean;
3758
+ definition: import('./alert-workflow-types').WorkflowDefinition | null;
3759
+ publishedAt: string | null;
3760
+ publishedBy: string | null;
3761
+ }
3762
+ export interface RestoreAlertWorkflowInput {
3763
+ version: number;
3764
+ expectedRevision: number;
3765
+ }
3766
+ export type PaymentInstrumentType = 'CARD' | 'VIRTUAL_CARD' | 'WALLET_TOKEN' | 'ACH_CREDENTIAL' | 'ONLINE_LOGIN' | 'DIGITAL_TOKEN' | 'CREDIT_CARD' | 'DEBIT_CARD' | 'PAYMENT_TOKEN' | 'API_KEY' | 'CRYPTO_WALLET' | 'OTHER';
3767
+ export type PaymentInstrumentStatus = 'ACTIVE' | 'BLOCKED' | 'EXPIRED' | 'LOST' | 'STOLEN' | 'FROZEN' | 'INACTIVE' | 'REVOKED' | 'COMPROMISED';
3768
+ export type ChannelEndpointStatus = 'ACTIVE' | 'INACTIVE' | 'SUSPENDED' | 'RETIRED' | 'UNKNOWN';
3769
+ export interface SessionDto {
3770
+ id: string;
3771
+ externalSessionId: string;
3772
+ customerId?: string | null;
3773
+ deviceId?: string | null;
3774
+ startedAt: string;
3775
+ lastActivityAt: string;
3776
+ metadata?: Record<string, unknown> | null;
3777
+ createdAt: string;
3778
+ }
3779
+ export interface UpdateSessionDto {
3780
+ customerId?: string | null;
3781
+ deviceId?: string | null;
3782
+ startedAt?: string;
3783
+ lastActivityAt?: string;
3784
+ metadata?: Record<string, unknown> | null;
3785
+ }
3786
+ export interface ChannelEndpointDto {
3787
+ id: string;
3788
+ externalId: string;
3789
+ kind: string;
3790
+ provider: string;
3791
+ displayName?: string | null;
3792
+ status: ChannelEndpointStatus;
3793
+ metadata?: Record<string, unknown> | null;
3794
+ firstSeenAt: string;
3795
+ lastSeenAt: string;
3796
+ createdAt: string;
3797
+ updatedAt: string;
3798
+ /** Catalogue-governed tags (`channelEndpoint.tags`). */
3799
+ tags: TagValue[];
3800
+ /** Set by the latest risk assessment. */
3801
+ riskRating?: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL' | null;
3802
+ }
3803
+ export interface UpdateChannelEndpointDto {
3804
+ displayName?: string | null;
3805
+ status?: ChannelEndpointStatus;
3806
+ metadata?: Record<string, unknown> | null;
3807
+ firstSeenAt?: string;
3808
+ lastSeenAt?: string;
3809
+ }
3810
+ export type PaymentInstrumentRelationshipSource = 'EXPLICIT' | 'TRANSACTION' | 'ANALYST' | 'RESOLUTION';
3811
+ export type PaymentInstrumentFingerprintType = 'CARD_PAN' | 'NETWORK_TOKEN' | 'WALLET_TOKEN' | 'ACH_CREDENTIAL' | 'ONLINE_LOGIN' | 'API_KEY' | 'CRYPTO_ADDRESS' | 'EXTERNAL_ID' | 'OTHER';
3812
+ export interface PaymentInstrumentFingerprintDto {
3813
+ type: PaymentInstrumentFingerprintType;
3814
+ /** Raw credential used only for protected fingerprint resolution; never persisted. */
3815
+ value: string;
3816
+ }
3817
+ export interface PaymentInstrumentPayloadDto {
3818
+ /** Internal Payment Instrument ID. */
3819
+ paymentInstrumentId?: string;
3820
+ /** Integration-owned stable Payment Instrument ID. */
3821
+ externalId?: string;
3822
+ type?: PaymentInstrumentType;
3823
+ fingerprint?: PaymentInstrumentFingerprintDto;
3824
+ }
3825
+ type PaymentInstrumentDecimalDigit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
3826
+ /** A safe masked payment-instrument suffix containing exactly four decimal digits. */
3827
+ export type PaymentInstrumentLast4 = `${PaymentInstrumentDecimalDigit}${PaymentInstrumentDecimalDigit}${PaymentInstrumentDecimalDigit}${PaymentInstrumentDecimalDigit}`;
3828
+ export interface AttemptPaymentInstrumentDto extends PaymentInstrumentPayloadDto {
3829
+ /** Safe issuer identification number for BIN/IIN attack analysis. */
3830
+ iin?: string;
3831
+ /** Safe masked suffix containing exactly four decimal digits. */
3832
+ last4?: PaymentInstrumentLast4;
3833
+ }
3834
+ export interface PaymentInstrumentDto {
3835
+ id: string;
3836
+ organizationId: string;
3837
+ externalId?: string | null;
3838
+ type: PaymentInstrumentType;
3839
+ status: PaymentInstrumentStatus;
3840
+ parentPaymentInstrumentId?: string | null;
3841
+ displayName?: string | null;
3842
+ createdSource: PaymentInstrumentRelationshipSource;
3843
+ managedAt?: string | null;
3844
+ firstSeenAt?: string | null;
3845
+ lastUsedAt?: string | null;
3846
+ issuedAt?: string | null;
3847
+ expiresAt?: string | null;
3848
+ riskFlags: string[];
3849
+ metadata: Record<string, unknown>;
3850
+ createdAt: string;
3851
+ updatedAt: string;
3852
+ }
3853
+ export interface CreatePaymentInstrumentDto {
3854
+ externalId?: string;
3855
+ type: PaymentInstrumentType;
3856
+ status?: PaymentInstrumentStatus;
3857
+ parentPaymentInstrumentId?: string;
3858
+ displayName?: string;
3859
+ createdSource: PaymentInstrumentRelationshipSource;
3860
+ managedAt?: string;
3861
+ firstSeenAt?: string;
3862
+ issuedAt?: string;
3863
+ expiresAt?: string;
3864
+ metadata?: Record<string, unknown>;
3865
+ }
3866
+ export interface UpdatePaymentInstrumentDto {
3867
+ status?: PaymentInstrumentStatus;
3868
+ parentPaymentInstrumentId?: string | null;
3869
+ displayName?: string | null;
3870
+ managedAt?: string | null;
3871
+ issuedAt?: string | null;
3872
+ expiresAt?: string | null;
3873
+ metadata?: Record<string, unknown>;
3874
+ }
3875
+ export interface LinkPaymentInstrumentAccountDto {
3876
+ accountId: string;
3877
+ relationshipType: 'ACCESS_CREDENTIAL' | 'FUNDING_SOURCE' | 'SETTLEMENT_DESTINATION' | 'OTHER';
3878
+ source: PaymentInstrumentRelationshipSource;
3879
+ validFrom?: string;
3880
+ validTo?: string;
3881
+ confidence?: number;
3882
+ }
3883
+ export interface LinkPaymentInstrumentCustomerDto {
3884
+ customerId: string;
3885
+ role: 'PRIMARY_HOLDER' | 'AUTHORIZED_USER' | 'CORPORATE_USER' | 'CUSTODIAN' | 'OBSERVED_USER';
3886
+ source: PaymentInstrumentRelationshipSource;
3887
+ validFrom?: string;
3888
+ validTo?: string;
3889
+ confidence?: number;
3890
+ }
3891
+ export interface PaymentInstrumentAccountRelationshipDto {
3892
+ id: string;
3893
+ accountId: string;
3894
+ paymentInstrumentId: string;
3895
+ relationshipType: 'ACCESS_CREDENTIAL' | 'FUNDING_SOURCE' | 'SETTLEMENT_DESTINATION' | 'OTHER';
3896
+ validFrom: string;
3897
+ validTo?: string | null;
3898
+ source: PaymentInstrumentRelationshipSource;
3899
+ confidence?: number | null;
3900
+ createdAt: string;
3901
+ updatedAt: string;
3902
+ }
3903
+ export interface PaymentInstrumentCustomerRelationshipDto {
3904
+ id: string;
3905
+ customerId: string;
3906
+ paymentInstrumentId: string;
3907
+ role: 'PRIMARY_HOLDER' | 'AUTHORIZED_USER' | 'CORPORATE_USER' | 'CUSTODIAN' | 'OBSERVED_USER';
3908
+ validFrom: string;
3909
+ validTo?: string | null;
3910
+ source: PaymentInstrumentRelationshipSource;
3911
+ confidence?: number | null;
3912
+ createdAt: string;
3913
+ updatedAt: string;
3914
+ }
3915
+ /** @deprecated Use the account- or customer-specific relationship response type. */
3916
+ export type PaymentInstrumentRelationshipDto = PaymentInstrumentAccountRelationshipDto | PaymentInstrumentCustomerRelationshipDto;
3917
+ export interface ConnectionEdge<T> {
3918
+ node: T;
3919
+ /** Opaque offset cursor. */
3920
+ cursor: string;
3921
+ }
3922
+ export interface ConnectionPageInfo {
3923
+ hasNextPage: boolean;
3924
+ hasPreviousPage: boolean;
3925
+ startCursor?: string;
3926
+ endCursor?: string;
3927
+ }
3928
+ export interface ConnectionPageMeta {
3929
+ page: number;
3930
+ pageSize: number;
3931
+ totalItems: number;
3932
+ totalPages: number;
3933
+ hasNextPage: boolean;
3934
+ hasPreviousPage: boolean;
3935
+ }
3936
+ /** Where a Risk Signal came from. Immutable provenance, set by the server. */
3937
+ export type RiskSignalSourceType = 'EVENT' | 'RULE' | 'MANUAL';
3938
+ export interface RiskSignal {
3939
+ id: string;
3940
+ /** Caller-supplied idempotency key, for explicitly created signals. */
3941
+ externalId?: string | null;
3942
+ /** Dotted signal type. Tenant vocabulary — not a fixed platform enum. */
3943
+ type: string;
3944
+ resourceType: RiskSignalResourceType;
3945
+ resourceId: string;
3946
+ /** Strength at `occurredAt`. Immutable. */
3947
+ weight: number;
3948
+ /** Half-life in seconds. Immutable. */
3949
+ halfLifeSeconds: number;
3950
+ /** Half-life as an ISO 8601 duration, e.g. `P7D`. Immutable. */
3951
+ halfLife: string;
3952
+ occurredAt: string;
3953
+ /** Decayed weight at the requested `asOf` time. */
3954
+ effectiveWeight: number;
3955
+ sourceType: RiskSignalSourceType;
3956
+ /** The Event id, evaluation id, or acting user id behind this signal. */
3957
+ sourceId: string;
3958
+ /** Safe audit facts only — never secrets or raw source payloads. */
3959
+ sourceSnapshot: Record<string, unknown>;
3960
+ createdBy: unknown;
3961
+ createdAt: string;
3962
+ }
3963
+ /**
3964
+ * Explicit Risk Signal creation.
3965
+ *
3966
+ * The caller does not choose the source: the server sets `sourceType: 'MANUAL'`
3967
+ * and captures the authenticated actor. There is deliberately no way to claim a
3968
+ * signal came from an Event or a Rule.
3969
+ */
3970
+ export interface CreateRiskSignalInput {
3971
+ /**
3972
+ * Your idempotency key for this signal (max 255 chars). Resubmitting the
3973
+ * same `externalId` returns the original signal rather than adding a
3974
+ * second one.
3975
+ */
3976
+ externalId?: string | null;
3977
+ /** Dotted signal type, e.g. `analyst.concerning_account_behaviour`. */
3978
+ type: string;
3979
+ resourceType: RiskSignalResourceType;
3980
+ resourceId: string;
3981
+ /** Strength at `occurredAt`. Must be greater than zero. */
3982
+ weight: number;
3983
+ /**
3984
+ * Half-life as a positive ISO 8601 duration, e.g. `P14D`. Calendar units
3985
+ * (Y/M) are rejected — they have no fixed length.
3986
+ */
3987
+ halfLife: string;
3988
+ /** When the evidence occurred (ISO 8601). Defaults to now. */
3989
+ occurredAt?: string | null;
3990
+ /** Analyst justification, recorded in the signal's source snapshot (max 2000 chars). */
3991
+ note?: string | null;
3992
+ }
3993
+ export interface ListRiskSignalsQuery {
3994
+ /** Required. Which kind of resource to read signals for. */
3995
+ resourceType: RiskSignalResourceType;
3996
+ /** Required. Id of that resource. */
3997
+ resourceId: string;
3998
+ /**
3999
+ * ISO 8601 timestamp the decay is computed as of. Defaults to server time;
4000
+ * a historical `asOf` returns what the resource looked like at that moment.
4001
+ */
4002
+ asOf?: string;
4003
+ /** Restrict which signal types contribute. Repeatable. */
4004
+ type?: string[];
4005
+ /** Restrict which provenances contribute. Repeatable. */
4006
+ sourceType?: RiskSignalSourceType[];
4007
+ /** 1–200. Defaults to 50. */
4008
+ limit?: number;
4009
+ /** Defaults to 0. */
4010
+ offset?: number;
4011
+ }
4012
+ /**
4013
+ * A resource's Risk Signals with their decayed weights, plus the aggregate.
4014
+ *
4015
+ * `type` / `sourceType` filter which records contribute; they never change how
4016
+ * far a contributing signal has decayed — age is always measured to `asOf`.
4017
+ */
4018
+ export interface RiskSignalListResponse {
4019
+ edges: ConnectionEdge<RiskSignal>[];
4020
+ pageInfo: ConnectionPageInfo;
4021
+ totalCount: number;
4022
+ /** The time the decay was computed as of. */
4023
+ asOf: string;
4024
+ /**
4025
+ * Sum of every contributing signal's effective weight at `asOf`. Computed
4026
+ * on read — not a cached score on the resource.
4027
+ */
4028
+ aggregateEffectiveWeight: number;
4029
+ /** Number of contributing signal records. */
4030
+ contributingCount: number;
4031
+ /** Latest contributing occurrence. */
4032
+ latestAt?: string | null;
4033
+ /** Distinct contributing signal types. */
4034
+ uniqueTypeCount: number;
4035
+ }
4036
+ export type EmployeeStatus = 'ACTIVE' | 'INACTIVE' | 'SUSPENDED' | 'TERMINATED';
4037
+ export type BranchStatus = 'ACTIVE' | 'INACTIVE' | 'CLOSED';
4038
+ export interface Employee {
4039
+ id: string;
4040
+ /** The institution's own staff identifier. */
4041
+ externalEmployeeId?: string | null;
4042
+ fullName: string;
4043
+ email?: string | null;
4044
+ jobTitle?: string | null;
4045
+ department?: string | null;
4046
+ /** Home Branch id. */
4047
+ branchId?: string | null;
4048
+ status: EmployeeStatus;
4049
+ /**
4050
+ * Optional link to the Dossiers organization member who is this same
4051
+ * person. Null for employees without a Dossiers login. Never an identity
4052
+ * substitute — Events and Risk Signals always attach by Employee id.
4053
+ */
4054
+ orgMemberId?: string | null;
4055
+ metadata: Record<string, unknown>;
4056
+ createdAt: string;
4057
+ updatedAt: string;
4058
+ lifecycle: Lifecycle;
4059
+ archivedAt?: string | null;
4060
+ tombstonedAt?: string | null;
4061
+ }
4062
+ export interface CreateEmployeeInput {
4063
+ fullName: string;
4064
+ /**
4065
+ * The institution's own staff identifier. Unique within the organization;
4066
+ * lets ingestion resolve an Employee without a Dossiers UUID round-trip.
4067
+ */
4068
+ externalEmployeeId?: string | null;
4069
+ email?: string | null;
4070
+ jobTitle?: string | null;
4071
+ department?: string | null;
4072
+ /** Home Branch id. Must belong to the same organization. */
4073
+ branchId?: string | null;
4074
+ /** Defaults to `ACTIVE`. */
4075
+ status?: EmployeeStatus;
4076
+ /**
4077
+ * Optional link to the Dossiers organization member who is this same
4078
+ * person. Leave unset for employees without a Dossiers login.
4079
+ */
4080
+ orgMemberId?: string | null;
4081
+ }
4082
+ export interface UpdateEmployeeInput {
4083
+ fullName?: string;
4084
+ email?: string | null;
4085
+ jobTitle?: string | null;
4086
+ department?: string | null;
4087
+ branchId?: string | null;
4088
+ status?: EmployeeStatus;
4089
+ orgMemberId?: string | null;
4090
+ metadata?: Record<string, unknown>;
4091
+ }
4092
+ export interface EmployeeListResponse {
4093
+ data: Employee[];
4094
+ edges: ConnectionEdge<Employee>[];
4095
+ pageInfo: ConnectionPageInfo;
4096
+ meta: ConnectionPageMeta;
4097
+ }
4098
+ export interface Branch {
4099
+ id: string;
4100
+ /** The institution's own branch identifier. */
4101
+ externalBranchId?: string | null;
4102
+ name: string;
4103
+ code?: string | null;
4104
+ country?: string | null;
4105
+ city?: string | null;
4106
+ /**
4107
+ * Owning Institution id, when the tenant models its own legal entities as
4108
+ * Institutions.
4109
+ */
4110
+ institutionId?: string | null;
4111
+ status: BranchStatus;
4112
+ metadata: Record<string, unknown>;
4113
+ createdAt: string;
4114
+ updatedAt: string;
4115
+ lifecycle: Lifecycle;
4116
+ archivedAt?: string | null;
4117
+ tombstonedAt?: string | null;
4118
+ }
4119
+ export interface CreateBranchInput {
4120
+ name: string;
4121
+ /**
4122
+ * The institution's own branch identifier. Unique within the organization;
4123
+ * lets ingestion resolve a Branch without a Dossiers UUID round-trip.
4124
+ */
4125
+ externalBranchId?: string | null;
4126
+ code?: string | null;
4127
+ country?: string | null;
4128
+ city?: string | null;
4129
+ institutionId?: string | null;
4130
+ /** Defaults to `ACTIVE`. */
4131
+ status?: BranchStatus;
4132
+ }
4133
+ export interface UpdateBranchInput {
4134
+ name?: string;
4135
+ code?: string | null;
4136
+ country?: string | null;
4137
+ city?: string | null;
4138
+ institutionId?: string | null;
4139
+ status?: BranchStatus;
4140
+ metadata?: Record<string, unknown>;
4141
+ }
4142
+ export interface BranchListResponse {
4143
+ data: Branch[];
4144
+ edges: ConnectionEdge<Branch>[];
4145
+ pageInfo: ConnectionPageInfo;
4146
+ meta: ConnectionPageMeta;
4147
+ }
4148
+ export type PartyRelationshipDirection = 'DIRECTED' | 'SYMMETRIC';
4149
+ export type PartyRelationshipPartyType = 'CUSTOMER' | 'COUNTERPARTY';
4150
+ export interface PartyRelationshipType {
4151
+ id: string;
4152
+ key: string;
4153
+ label: string;
4154
+ description?: string | null;
4155
+ direction: PartyRelationshipDirection;
4156
+ createdAt: string;
4157
+ updatedAt: string;
4158
+ }
4159
+ export interface CreatePartyRelationshipTypeInput {
4160
+ key: string;
4161
+ label: string;
4162
+ description?: string;
4163
+ direction: PartyRelationshipDirection;
4164
+ }
4165
+ /** One end of a relationship, resolved to something displayable. */
4166
+ export interface PartyRef {
4167
+ type: PartyRelationshipPartyType;
4168
+ id: string;
4169
+ label: string;
4170
+ }
4171
+ export interface PartyRelationship {
4172
+ id: string;
4173
+ typeId: string;
4174
+ relationshipType: PartyRelationshipType;
4175
+ sourceType: PartyRelationshipPartyType;
4176
+ sourceId: string;
4177
+ targetType: PartyRelationshipPartyType;
4178
+ targetId: string;
4179
+ sourceParty?: PartyRef | null;
4180
+ targetParty?: PartyRef | null;
4181
+ description?: string | null;
4182
+ validFrom?: string | null;
4183
+ validTo?: string | null;
4184
+ source?: string | null;
4185
+ confidence?: number | null;
4186
+ createdAt: string;
4187
+ updatedAt: string;
4188
+ }
4189
+ export interface CreatePartyRelationshipInput {
4190
+ typeId: string;
4191
+ sourceType: PartyRelationshipPartyType;
4192
+ sourceId: string;
4193
+ targetType: PartyRelationshipPartyType;
4194
+ targetId: string;
4195
+ description?: string;
4196
+ validFrom?: string;
4197
+ validTo?: string;
4198
+ source?: string;
4199
+ confidence?: number;
4200
+ }
4201
+ export type AlertRiskLevel = 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
4202
+ /**
4203
+ * An org-defined alert type. CUSTOM alerts name one of these and carry typed
4204
+ * field values validated against `fields` (Tier A) when raised. Editing the
4205
+ * schema never re-validates existing alerts.
4206
+ */
4207
+ export interface CustomAlertTypeResponseDto {
4208
+ id: string;
4209
+ /** Stable snake_case machine name; integrators raise alerts by it. Immutable. */
4210
+ name: string;
4211
+ displayName: string;
4212
+ description: string | null;
4213
+ fields: TypedFieldDefinition[];
4214
+ /** Applied when the creator does not choose a risk level. */
4215
+ defaultRiskLevel: AlertRiskLevel;
4216
+ lifecycle: 'LIVE' | 'ARCHIVED' | 'TOMBSTONED';
4217
+ createdAt: string;
4218
+ updatedAt: string;
4219
+ archivedAt?: string | null;
4220
+ tombstonedAt?: string | null;
4221
+ }
4222
+ export interface CreateCustomAlertTypeDto {
4223
+ /** snake_case, starts with a letter, max 64 chars. */
4224
+ name: string;
4225
+ displayName: string;
4226
+ description?: string | null;
4227
+ fields?: TypedFieldDefinition[];
4228
+ /** Defaults to MEDIUM. */
4229
+ defaultRiskLevel?: AlertRiskLevel;
4230
+ }
4231
+ export interface UpdateCustomAlertTypeDto {
4232
+ displayName?: string;
4233
+ description?: string | null;
4234
+ /** Replaces the schema. Applies to alerts raised afterwards only. */
4235
+ fields?: TypedFieldDefinition[];
4236
+ defaultRiskLevel?: AlertRiskLevel;
4237
+ }
4238
+ /** A resource to link to an alert. `resourceType` is case-insensitive (`customer` and `CUSTOMER` both work). */
4239
+ export interface AlertResourceRefDto {
4240
+ resourceType: string;
4241
+ resourceId: string;
4242
+ }
4243
+ export interface AlertResourceDto {
4244
+ /** Link id — pass this to `removeResource`, not the target's id. */
4245
+ id: string;
4246
+ resourceType: string;
4247
+ resourceId: string;
4248
+ addedBy: {
4249
+ userId: string;
4250
+ name: string;
4251
+ };
4252
+ createdAt: string;
4253
+ }
4254
+ export interface CreateCustomAlertDto {
4255
+ /**
4256
+ * Optional. Machine name (or id) of a LIVE custom alert type. Omit for a
4257
+ * free-form alert. With a type that declares fields, `fields` are validated
4258
+ * against its schema; otherwise they are self-declaring.
4259
+ */
4260
+ alertType?: string | null;
4261
+ subject: string;
4262
+ /** Defaults to the type's `defaultRiskLevel`. */
4263
+ riskLevel?: AlertRiskLevel;
4264
+ /** Customer the alert is about. Archived customers are allowed. */
4265
+ customerId?: string | null;
4266
+ /** Markdown narrative. */
4267
+ notes?: string | null;
4268
+ /** Structured details. Validated against the type's schema when one is given, self-declaring otherwise. */
4269
+ fields?: TypedFieldValueInput[];
4270
+ /** Org member ids to assign at creation; they are notified. */
4271
+ assignedToUserIds?: string[];
4272
+ /** Team ids to assign at creation; members are notified. */
4273
+ assignedToTeamIds?: string[];
4274
+ resources?: AlertResourceRefDto[];
4275
+ /**
4276
+ * Idempotency key, scoped per **organization** (not per API key): two
4277
+ * keys replaying the same upstream event converge on one alert.
4278
+ */
4279
+ externalRequestId?: string | null;
4280
+ }
4281
+ export interface UpdateAlertNotesDto {
4282
+ /** Markdown. Null or empty clears the notes. */
4283
+ notes?: string | null;
4284
+ }
4285
+ /** Flat REST view of an alert (any type). The GraphQL surface carries the rich per-type shape. */
4286
+ export interface AlertResponseDto {
4287
+ id: string;
4288
+ type: 'SCREENING' | 'RULE_TRIGGER' | 'CUSTOM';
4289
+ customAlertTypeId: string | null;
4290
+ status: 'OPEN' | 'CLOSED';
4291
+ subject: string;
4292
+ riskLevel: AlertRiskLevel;
4293
+ customerId: string | null;
4294
+ assignedToUserIds: string[];
4295
+ assignedToTeamIds: string[];
4296
+ /** Stored typed-field bag (`{ [key]: { type, value } }`) for CUSTOM alerts; `{}` otherwise. */
4297
+ fields: Record<string, unknown>;
4298
+ notes: string | null;
4299
+ createdBy: {
4300
+ type: 'USER' | 'SERVICE' | 'UNRESOLVED';
4301
+ userId: string;
4302
+ name: string;
4303
+ } | null;
4304
+ externalRequestId: string | null;
4305
+ disposition: string | null;
4306
+ dispositionReason: string | null;
4307
+ closedAt: string | null;
4308
+ createdAt: string;
4309
+ updatedAt: string;
4310
+ /** Present on `alerts.create` and `alerts.get`. */
4311
+ resources?: AlertResourceDto[];
4312
+ }
1685
4313
  //# sourceMappingURL=types.d.ts.map