@zernio/node 0.2.310 → 0.2.312

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.
@@ -911,6 +911,148 @@ export type BusinessCenter = {
911
911
  advertiserCount?: (number) | null;
912
912
  };
913
913
 
914
+ /**
915
+ * One call on a number you own, either channel. `channel` tells you which
916
+ * lane it took: `whatsapp` (WhatsApp Business Calling) or `pstn` (a regular
917
+ * phone call). List endpoints omit `transcript`; use `lastTranscriptSnippet`
918
+ * for a preview and the detail endpoint for the full transcript.
919
+ *
920
+ */
921
+ export type CallRecord = {
922
+ _id?: string;
923
+ /**
924
+ * Owning social account. The unified /v1/calls/{id} detail + recording endpoints work for any channel; the channel-specific endpoints remain for account-scoped access.
925
+ */
926
+ accountId?: string;
927
+ /**
928
+ * Inbox conversation with the counterparty, when one exists.
929
+ */
930
+ conversationId?: (string) | null;
931
+ /**
932
+ * CRM Contact for the counterparty, when resolved.
933
+ */
934
+ contactId?: (string) | null;
935
+ channel?: 'whatsapp' | 'pstn';
936
+ direction?: 'inbound' | 'outbound';
937
+ /**
938
+ * Caller number (E.164).
939
+ */
940
+ from?: string;
941
+ /**
942
+ * Callee number (E.164).
943
+ */
944
+ to?: string;
945
+ /**
946
+ * Destination the call was routed to (tel:/sip:/wss:), snapshotted at routing time.
947
+ */
948
+ forwardTo?: (string) | null;
949
+ /**
950
+ * Outbound PSTN only. Message spoken to the callee on answer, before the bridge.
951
+ */
952
+ greeting?: (string) | null;
953
+ status?: 'ringing' | 'answered' | 'ended' | 'failed';
954
+ /**
955
+ * True when an inbound call went to voicemail.
956
+ */
957
+ isVoicemail?: boolean;
958
+ /**
959
+ * Outbound answering-machine detection was requested for this call.
960
+ */
961
+ amd?: boolean;
962
+ /**
963
+ * With `amd`, whether a machine (vs a human) answered.
964
+ */
965
+ answeredMachine?: (boolean) | null;
966
+ /**
967
+ * Caller ID presented on the forwarded leg.
968
+ */
969
+ forwardCallerId?: 'business' | 'caller';
970
+ /**
971
+ * Effective flag for THIS call (number default + per-call override, resolved at create time).
972
+ */
973
+ recordingEnabled?: boolean;
974
+ transcriptionEnabled?: boolean;
975
+ transcriptionLanguage?: 'auto' | 'en' | 'es';
976
+ startedAt?: string;
977
+ answeredAt?: (string) | null;
978
+ endedAt?: (string) | null;
979
+ /**
980
+ * When the call was blind-transferred (POST /v1/voice/calls/{id}/transfer).
981
+ */
982
+ transferredAt?: (string) | null;
983
+ durationSeconds?: number;
984
+ endReason?: 'hangup' | 'no_answer' | 'rejected' | 'error';
985
+ /**
986
+ * Raw carrier hangup cause behind endReason (e.g. normal_clearing, not_found, time_limit) — the actual motive when endReason is a coarse bucket.
987
+ */
988
+ hangupCause?: (string) | null;
989
+ /**
990
+ * SIP response code that ended the call, when SIP-signalled (e.g. '403', '488'). The real failure reason for SIP legs.
991
+ */
992
+ sipHangupCause?: (string) | null;
993
+ /**
994
+ * Per-call failure log (dial failed, bridge failed, recording error).
995
+ */
996
+ callErrors?: Array<{
997
+ code?: number;
998
+ message?: string;
999
+ }>;
1000
+ /**
1001
+ * May be expired. Resolve a fresh playable URL via GET /v1/calls/{id}/recording (any channel).
1002
+ */
1003
+ recordingUrl?: (string) | null;
1004
+ /**
1005
+ * Most recent transcript segment, for list previews.
1006
+ */
1007
+ lastTranscriptSnippet?: (string) | null;
1008
+ /**
1009
+ * Full transcript segments (detail endpoint only; omitted from lists).
1010
+ */
1011
+ transcript?: Array<{
1012
+ text?: string;
1013
+ confidence?: number;
1014
+ at?: string;
1015
+ }>;
1016
+ billing?: {
1017
+ metaMinutes?: number;
1018
+ telnyxSeconds?: number;
1019
+ transcriptionSeconds?: number;
1020
+ transcriptionCostUSD?: number;
1021
+ /**
1022
+ * WhatsApp channel only. Meta per-minute charge, billed by Meta directly to your WABA. Display only; not billed by Zernio.
1023
+ */
1024
+ metaCostUSD?: number;
1025
+ telnyxCostUSD?: number;
1026
+ recordingCostUSD?: number;
1027
+ /**
1028
+ * Amount Zernio bills you = telephony leg + recording + transcription (excludes any Meta portion).
1029
+ */
1030
+ billableCostUSD?: number;
1031
+ /**
1032
+ * Full cost incl. any Meta portion you pay directly. Display only.
1033
+ */
1034
+ totalCostUSD?: number;
1035
+ currency?: string;
1036
+ };
1037
+ createdAt?: string;
1038
+ updatedAt?: string;
1039
+ };
1040
+
1041
+ export type channel = 'whatsapp' | 'pstn';
1042
+
1043
+ export type direction = 'inbound' | 'outbound';
1044
+
1045
+ export type status2 = 'ringing' | 'answered' | 'ended' | 'failed';
1046
+
1047
+ /**
1048
+ * Caller ID presented on the forwarded leg.
1049
+ */
1050
+ export type forwardCallerId = 'business' | 'caller';
1051
+
1052
+ export type transcriptionLanguage = 'auto' | 'en' | 'es';
1053
+
1054
+ export type endReason = 'hangup' | 'no_answer' | 'rejected' | 'error';
1055
+
914
1056
  /**
915
1057
  * A discoverable conversion destination on an ad platform — a Meta pixel,
916
1058
  * Google conversion action, or LinkedIn conversion rule. Returned by
@@ -951,7 +1093,7 @@ export type ConversionDestination = {
951
1093
  * For LinkedIn, `inactive` means the rule is soft-deleted (`enabled: false`).
952
1094
  *
953
1095
  */
954
- export type status2 = 'active' | 'inactive';
1096
+ export type status3 = 'active' | 'inactive';
955
1097
 
956
1098
  /**
957
1099
  * A single conversion event to relay to the ad platform. All PII fields
@@ -1372,7 +1514,7 @@ export type privacy_level = 2;
1372
1514
  /**
1373
1515
  * 1=SCHEDULED, 2=ACTIVE, 3=COMPLETED, 4=CANCELED
1374
1516
  */
1375
- export type status3 = 1 | 2 | 3 | 4;
1517
+ export type status4 = 1 | 2 | 3 | 4;
1376
1518
 
1377
1519
  /**
1378
1520
  * 1=STAGE_INSTANCE, 2=VOICE, 3=EXTERNAL
@@ -1868,6 +2010,10 @@ export type InboxWebhookAccount = {
1868
2010
  * Social account ID (same value as id). Canonical field so consumers can filter every webhook event on one field (e.g. route staging vs production by account). id is kept for backward compatibility.
1869
2011
  */
1870
2012
  accountId?: string;
2013
+ /**
2014
+ * Zernio profile (workspace) ID this account belongs to. Use it to route or filter inbox webhooks by workspace. This is the profile ID only, not its name (resolve the name via the API with this ID). Optional; omitted on the shared WhatsApp sandbox account and when the account has no resolvable profile.
2015
+ */
2016
+ profileId?: string;
1871
2017
  platform: string;
1872
2018
  username: string;
1873
2019
  displayName?: string;
@@ -1896,7 +2042,7 @@ export type InboxWebhookConversation = {
1896
2042
  contactId?: string;
1897
2043
  };
1898
2044
 
1899
- export type status4 = 'active' | 'archived';
2045
+ export type status5 = 'active' | 'archived';
1900
2046
 
1901
2047
  /**
1902
2048
  * The message object included in inbox webhook payloads.
@@ -2005,7 +2151,7 @@ export type InboxWebhookMessage = {
2005
2151
 
2006
2152
  export type platform2 = 'instagram' | 'facebook' | 'telegram' | 'whatsapp';
2007
2153
 
2008
- export type direction = 'incoming' | 'outgoing';
2154
+ export type direction2 = 'incoming' | 'outgoing';
2009
2155
 
2010
2156
  /**
2011
2157
  * Shared account-insights response envelope used by every platform-level
@@ -2448,7 +2594,7 @@ export type PlatformAnalytics = {
2448
2594
  errorMessage?: (string) | null;
2449
2595
  };
2450
2596
 
2451
- export type status5 = 'published' | 'failed';
2597
+ export type status6 = 'published' | 'failed';
2452
2598
 
2453
2599
  /**
2454
2600
  * Sync state of analytics for this platform
@@ -2571,7 +2717,7 @@ export type Post = {
2571
2717
  updatedAt?: string;
2572
2718
  };
2573
2719
 
2574
- export type status6 = 'draft' | 'scheduled' | 'publishing' | 'published' | 'failed' | 'partial';
2720
+ export type status7 = 'draft' | 'scheduled' | 'publishing' | 'published' | 'failed' | 'partial';
2575
2721
 
2576
2722
  export type visibility = 'public' | 'private' | 'unlisted';
2577
2723
 
@@ -3614,7 +3760,7 @@ export type UploadTokenResponse = {
3614
3760
  status?: 'pending' | 'completed' | 'expired';
3615
3761
  };
3616
3762
 
3617
- export type status7 = 'pending' | 'completed' | 'expired';
3763
+ export type status8 = 'pending' | 'completed' | 'expired';
3618
3764
 
3619
3765
  export type UploadTokenStatusResponse = {
3620
3766
  token?: string;
@@ -3893,7 +4039,7 @@ export type WebhookLog = {
3893
4039
  /**
3894
4040
  * Delivery outcome
3895
4041
  */
3896
- export type status8 = 'success' | 'failed';
4042
+ export type status9 = 'success' | 'failed';
3897
4043
 
3898
4044
  /**
3899
4045
  * Webhook payload for `account.ads.initial_sync_completed` events.
@@ -4002,7 +4148,7 @@ export type event = 'account.ads.initial_sync_completed';
4002
4148
  /**
4003
4149
  * Overall outcome of the initial sync.
4004
4150
  */
4005
- export type status9 = 'success' | 'failure';
4151
+ export type status10 = 'success' | 'failure';
4006
4152
 
4007
4153
  /**
4008
4154
  * Stable category for UX branching. New values may be added; existing ones are
@@ -4253,10 +4399,6 @@ export type WebhookPayloadCallEnded = {
4253
4399
 
4254
4400
  export type event5 = 'call.ended';
4255
4401
 
4256
- export type direction2 = 'inbound' | 'outbound';
4257
-
4258
- export type endReason = 'hangup' | 'no_answer' | 'rejected' | 'error';
4259
-
4260
4402
  /**
4261
4403
  * Webhook payload for the `call.failed` event. Fired when a call
4262
4404
  * setup or in-progress call fails.
@@ -5390,7 +5532,7 @@ export type platform10 = 'whatsapp';
5390
5532
  * request before the template is actually removed.
5391
5533
  *
5392
5534
  */
5393
- export type status10 = 'APPROVED' | 'REJECTED' | 'PENDING' | 'PAUSED' | 'DISABLED' | 'IN_APPEAL' | 'PENDING_DELETION';
5535
+ export type status11 = 'APPROVED' | 'REJECTED' | 'PENDING' | 'PAUSED' | 'DISABLED' | 'IN_APPEAL' | 'PENDING_DELETION';
5394
5536
 
5395
5537
  export type WhatsAppBodyComponent = {
5396
5538
  type: 'body';
@@ -5491,7 +5633,7 @@ export type WhatsAppSandboxSession = {
5491
5633
  * list responses.
5492
5634
  *
5493
5635
  */
5494
- export type status11 = 'pending' | 'active';
5636
+ export type status12 = 'pending' | 'active';
5495
5637
 
5496
5638
  export type WhatsAppTemplateButton = {
5497
5639
  type: 'quick_reply' | 'url' | 'phone_number' | 'otp' | 'copy_code' | 'flow' | 'mpm' | 'catalog';
@@ -5610,7 +5752,7 @@ export type WorkflowExecutionEvent = {
5610
5752
 
5611
5753
  export type action2 = 'execution_started' | 'execution_completed' | 'execution_exited' | 'execution_paused' | 'execution_resumed' | 'node_started' | 'node_completed' | 'node_failed' | 'node_skipped';
5612
5754
 
5613
- export type status12 = 'success' | 'failed' | 'pending';
5755
+ export type status13 = 'success' | 'failed' | 'pending';
5614
5756
 
5615
5757
  /**
5616
5758
  * A node in a workflow graph. `config` shape depends on `type`.
@@ -7536,6 +7678,26 @@ export type GetXApiPricingError = ({
7536
7678
  error?: string;
7537
7679
  });
7538
7680
 
7681
+ export type GetUsageData = {
7682
+ query?: {
7683
+ /**
7684
+ * For Stripe subscription users, `true` forces a subscription
7685
+ * reconciliation pass even when cached plan data looks complete.
7686
+ * Omit the parameter, or pass `false`, to use the default
7687
+ * first-time-only reconciliation behavior. Invalid boolean values are
7688
+ * rejected.
7689
+ *
7690
+ */
7691
+ reconcile?: boolean;
7692
+ };
7693
+ };
7694
+
7695
+ export type GetUsageResponse = (UsageStats);
7696
+
7697
+ export type GetUsageError = (unknown | {
7698
+ error?: string;
7699
+ });
7700
+
7539
7701
  export type GetUsageStatsData = {
7540
7702
  query?: {
7541
7703
  /**
@@ -7556,6 +7718,107 @@ export type GetUsageStatsError = (unknown | {
7556
7718
  error?: string;
7557
7719
  });
7558
7720
 
7721
+ export type GetCallsUsageData = {
7722
+ query?: {
7723
+ channel?: 'whatsapp' | 'pstn';
7724
+ groupBy?: 'day' | 'number' | 'channel';
7725
+ /**
7726
+ * Scope to calls involving this number (typically one of YOUR numbers). E.164, leading + optional.
7727
+ */
7728
+ number?: string;
7729
+ /**
7730
+ * Start of the window (inclusive). Default 30 days before `until`.
7731
+ */
7732
+ since?: string;
7733
+ /**
7734
+ * End of the window (exclusive). Default now.
7735
+ */
7736
+ until?: string;
7737
+ };
7738
+ };
7739
+
7740
+ export type GetCallsUsageResponse = ({
7741
+ since?: string;
7742
+ until?: string;
7743
+ groupBy?: ('day' | 'number' | 'channel') | null;
7744
+ totals?: {
7745
+ calls?: number;
7746
+ answered?: number;
7747
+ minutes?: number;
7748
+ /**
7749
+ * What Zernio bills for these calls.
7750
+ */
7751
+ billableUSD?: number;
7752
+ /**
7753
+ * WhatsApp only: Meta's per-minute charge, billed by Meta directly to your WABA. Display only.
7754
+ */
7755
+ metaUSD?: number;
7756
+ };
7757
+ /**
7758
+ * Present (possibly empty) when `groupBy` is set.
7759
+ */
7760
+ groups?: Array<{
7761
+ /**
7762
+ * The group key: a `YYYY-MM-DD` UTC day, one of your numbers, or a channel.
7763
+ */
7764
+ key?: string;
7765
+ calls?: number;
7766
+ answered?: number;
7767
+ minutes?: number;
7768
+ billableUSD?: number;
7769
+ metaUSD?: number;
7770
+ }>;
7771
+ });
7772
+
7773
+ export type GetCallsUsageError = (unknown | {
7774
+ error?: string;
7775
+ });
7776
+
7777
+ export type GetSmsUsageData = {
7778
+ query?: {
7779
+ groupBy?: 'day' | 'number';
7780
+ /**
7781
+ * Scope to one of YOUR SMS-enabled numbers (E.164, leading + optional).
7782
+ */
7783
+ number?: string;
7784
+ /**
7785
+ * Start of the window (inclusive). Default 30 days before `until`.
7786
+ */
7787
+ since?: string;
7788
+ /**
7789
+ * End of the window (exclusive). Default now.
7790
+ */
7791
+ until?: string;
7792
+ };
7793
+ };
7794
+
7795
+ export type GetSmsUsageResponse = ({
7796
+ since?: string;
7797
+ until?: string;
7798
+ groupBy?: ('day' | 'number') | null;
7799
+ totals?: {
7800
+ sent?: number;
7801
+ received?: number;
7802
+ total?: number;
7803
+ };
7804
+ /**
7805
+ * Present (possibly empty) when `groupBy` is set.
7806
+ */
7807
+ groups?: Array<{
7808
+ /**
7809
+ * A `YYYY-MM-DD` UTC day or one of your numbers.
7810
+ */
7811
+ key?: string;
7812
+ sent?: number;
7813
+ received?: number;
7814
+ total?: number;
7815
+ }>;
7816
+ });
7817
+
7818
+ export type GetSmsUsageError = (unknown | {
7819
+ error?: string;
7820
+ });
7821
+
7559
7822
  export type ListPostsData = {
7560
7823
  query?: {
7561
7824
  /**
@@ -14977,7 +15240,7 @@ export type GetWhatsAppCallingConfigData = {
14977
15240
 
14978
15241
  export type GetWhatsAppCallingConfigResponse = ({
14979
15242
  /**
14980
- * WhatsAppPhoneNumber Mongo ID (use on /v1/whatsapp/phone-numbers/{id}/calling)
15243
+ * Phone number record ID (use on /v1/phone-numbers/{id}/whatsapp/calling)
14981
15244
  */
14982
15245
  phoneNumberDocId?: string;
14983
15246
  phoneNumber?: string;
@@ -15003,7 +15266,7 @@ export type GetWhatsAppCallingConfigError = ({
15003
15266
  error?: string;
15004
15267
  } | unknown);
15005
15268
 
15006
- export type EnableWhatsAppCallingData = {
15269
+ export type EnableWhatsAppCallingLegacyData = {
15007
15270
  body: {
15008
15271
  accountId: string;
15009
15272
  /**
@@ -15026,18 +15289,18 @@ export type EnableWhatsAppCallingData = {
15026
15289
  };
15027
15290
  };
15028
15291
 
15029
- export type EnableWhatsAppCallingResponse = ({
15292
+ export type EnableWhatsAppCallingLegacyResponse = ({
15030
15293
  success?: boolean;
15031
15294
  callingEnabled?: boolean;
15032
15295
  sipHostname?: string;
15033
15296
  forwardTo?: string;
15034
15297
  });
15035
15298
 
15036
- export type EnableWhatsAppCallingError = ({
15299
+ export type EnableWhatsAppCallingLegacyError = ({
15037
15300
  error?: string;
15038
15301
  } | unknown);
15039
15302
 
15040
- export type UpdateWhatsAppCallingData = {
15303
+ export type UpdateWhatsAppCallingLegacyData = {
15041
15304
  body: {
15042
15305
  accountId: string;
15043
15306
  forwardTo?: string;
@@ -15051,13 +15314,13 @@ export type UpdateWhatsAppCallingData = {
15051
15314
  };
15052
15315
  };
15053
15316
 
15054
- export type UpdateWhatsAppCallingResponse = (unknown);
15317
+ export type UpdateWhatsAppCallingLegacyResponse = (unknown);
15055
15318
 
15056
- export type UpdateWhatsAppCallingError = ({
15319
+ export type UpdateWhatsAppCallingLegacyError = ({
15057
15320
  error?: string;
15058
15321
  } | unknown);
15059
15322
 
15060
- export type DisableWhatsAppCallingData = {
15323
+ export type DisableWhatsAppCallingLegacyData = {
15061
15324
  path: {
15062
15325
  id: string;
15063
15326
  };
@@ -15066,9 +15329,9 @@ export type DisableWhatsAppCallingData = {
15066
15329
  };
15067
15330
  };
15068
15331
 
15069
- export type DisableWhatsAppCallingResponse = (unknown);
15332
+ export type DisableWhatsAppCallingLegacyResponse = (unknown);
15070
15333
 
15071
- export type DisableWhatsAppCallingError = ({
15334
+ export type DisableWhatsAppCallingLegacyError = ({
15072
15335
  error?: string;
15073
15336
  } | unknown);
15074
15337
 
@@ -15130,6 +15393,12 @@ export type InitiateWhatsAppCallData = {
15130
15393
  */
15131
15394
  biz_opaque_callback_data?: string;
15132
15395
  };
15396
+ headers?: {
15397
+ /**
15398
+ * Optional client-generated unique key (e.g. a UUID) that makes dial retries safe. Same key + same body replays the original response; same key + different body → 422; key still processing → 409.
15399
+ */
15400
+ 'Idempotency-Key'?: string;
15401
+ };
15133
15402
  };
15134
15403
 
15135
15404
  export type InitiateWhatsAppCallResponse = ({
@@ -15156,6 +15425,10 @@ export type InitiateWhatsAppCallError = ({
15156
15425
  export type ListWhatsAppCallsData = {
15157
15426
  query: {
15158
15427
  accountId: string;
15428
+ /**
15429
+ * Return calls with startedAt strictly before this instant (use the previous page's nextCursor).
15430
+ */
15431
+ before?: string;
15159
15432
  direction?: 'inbound' | 'outbound';
15160
15433
  limit?: number;
15161
15434
  since?: string;
@@ -15194,6 +15467,10 @@ export type ListWhatsAppCallsResponse = ({
15194
15467
  currency?: string;
15195
15468
  };
15196
15469
  }>;
15470
+ /**
15471
+ * Pass as `before` for the next page; null on the last page.
15472
+ */
15473
+ nextCursor?: (string) | null;
15197
15474
  });
15198
15475
 
15199
15476
  export type ListWhatsAppCallsError = ({
@@ -15219,6 +15496,27 @@ export type GetWhatsAppCallError = ({
15219
15496
  error?: string;
15220
15497
  } | unknown);
15221
15498
 
15499
+ export type GetWhatsAppCallRecordingData = {
15500
+ path: {
15501
+ callId: string;
15502
+ };
15503
+ query: {
15504
+ accountId: string;
15505
+ /**
15506
+ * `json` returns `{ url }` instead of a 302 redirect.
15507
+ */
15508
+ as?: 'json';
15509
+ };
15510
+ };
15511
+
15512
+ export type GetWhatsAppCallRecordingResponse = ({
15513
+ url?: string;
15514
+ });
15515
+
15516
+ export type GetWhatsAppCallRecordingError = (unknown | {
15517
+ error?: string;
15518
+ });
15519
+
15222
15520
  export type GetWhatsAppCallEstimateData = {
15223
15521
  query: {
15224
15522
  accountId: string;
@@ -15254,512 +15552,709 @@ export type GetWhatsAppCallEstimateError = ({
15254
15552
  error?: string;
15255
15553
  });
15256
15554
 
15257
- export type GetWhatsAppLibraryTemplateData = {
15258
- query: {
15555
+ export type ListCallsData = {
15556
+ query?: {
15259
15557
  /**
15260
- * WhatsApp social account ID
15558
+ * Return calls with startedAt strictly before this instant (use the previous page's nextCursor).
15261
15559
  */
15262
- accountId: string;
15560
+ before?: string;
15561
+ channel?: 'whatsapp' | 'pstn';
15562
+ direction?: 'inbound' | 'outbound';
15563
+ limit?: number;
15263
15564
  /**
15264
- * Exact library template name
15565
+ * Exact filter: calls involving this number (typically one of YOUR numbers, to scope history to a single line). E.164, leading + optional.
15265
15566
  */
15266
- name: string;
15567
+ number?: string;
15568
+ /**
15569
+ * Free-text match on the from/to numbers. Non-digits are stripped, so partial queries like `302` or `+1 302` work.
15570
+ */
15571
+ search?: string;
15572
+ status?: 'ringing' | 'answered' | 'ended' | 'failed';
15267
15573
  };
15268
15574
  };
15269
15575
 
15270
- export type GetWhatsAppLibraryTemplateResponse = ({
15271
- template?: {
15272
- name?: string;
15273
- language?: string;
15274
- category?: string;
15275
- body?: string;
15276
- body_params?: Array<(string)>;
15277
- buttons?: Array<{
15278
- /**
15279
- * QUICK_REPLY, URL, PHONE_NUMBER, OTP, FLOW, ...
15280
- */
15281
- type?: string;
15282
- text?: string;
15283
- }>;
15284
- } | null;
15576
+ export type ListCallsResponse = ({
15577
+ calls?: Array<(CallRecord & {
15578
+ /**
15579
+ * CRM contact name for the counterparty, when resolved.
15580
+ */
15581
+ contactName?: string;
15582
+ })>;
15583
+ /**
15584
+ * Pass as `before` for the next page; null on the last page.
15585
+ */
15586
+ nextCursor?: (string) | null;
15285
15587
  });
15286
15588
 
15287
- export type GetWhatsAppLibraryTemplateError = (unknown | {
15589
+ export type ListCallsError = ({
15288
15590
  error?: string;
15591
+ } | unknown);
15592
+
15593
+ export type GetCallData = {
15594
+ path: {
15595
+ id: string;
15596
+ };
15597
+ };
15598
+
15599
+ export type GetCallResponse = ({
15600
+ call?: (CallRecord & {
15601
+ /**
15602
+ * CRM contact name for the counterparty, when resolved.
15603
+ */
15604
+ contactName?: string;
15605
+ });
15289
15606
  });
15290
15607
 
15291
- export type GetWhatsAppBusinessProfileData = {
15292
- query: {
15608
+ export type GetCallError = ({
15609
+ error?: string;
15610
+ } | unknown);
15611
+
15612
+ export type GetCallRecordingData = {
15613
+ path: {
15614
+ id: string;
15615
+ };
15616
+ query?: {
15293
15617
  /**
15294
- * WhatsApp social account ID
15618
+ * `json` returns `{ url }` instead of a 302 redirect.
15295
15619
  */
15296
- accountId: string;
15620
+ as?: 'json';
15297
15621
  };
15298
15622
  };
15299
15623
 
15300
- export type GetWhatsAppBusinessProfileResponse = ({
15301
- success?: boolean;
15302
- businessProfile?: {
15303
- /**
15304
- * Short description (max 139 chars)
15305
- */
15306
- about?: string;
15307
- address?: string;
15308
- /**
15309
- * Full description (max 512 chars)
15310
- */
15311
- description?: string;
15312
- email?: string;
15313
- profilePictureUrl?: string;
15314
- websites?: Array<(string)>;
15315
- /**
15316
- * Business category
15317
- */
15318
- vertical?: string;
15319
- };
15624
+ export type GetCallRecordingResponse = ({
15625
+ url?: string;
15320
15626
  });
15321
15627
 
15322
- export type GetWhatsAppBusinessProfileError = (unknown | {
15628
+ export type GetCallRecordingError = (unknown | {
15323
15629
  error?: string;
15324
15630
  });
15325
15631
 
15326
- export type UpdateWhatsAppBusinessProfileData = {
15632
+ export type CreateVoiceCallData = {
15327
15633
  body: {
15328
15634
  /**
15329
- * WhatsApp social account ID
15635
+ * Destination to dial, E.164 with leading +.
15330
15636
  */
15331
- accountId: string;
15637
+ to: string;
15332
15638
  /**
15333
- * Short business description (max 139 characters)
15639
+ * Which of your voice-enabled numbers to dial from. Optional when you have exactly one.
15334
15640
  */
15335
- about?: string;
15641
+ fromNumber?: string;
15336
15642
  /**
15337
- * Business address
15643
+ * Per-call agent override (tel:+E164, sip:..., or wss://...); defaults to the number's stored forward destination.
15338
15644
  */
15339
- address?: string;
15645
+ forwardTo?: string;
15340
15646
  /**
15341
- * Full business description (max 512 characters)
15647
+ * Spoken to the callee when they answer, before the bridge.
15342
15648
  */
15343
- description?: string;
15649
+ greeting?: string;
15344
15650
  /**
15345
- * Business email
15651
+ * Per-call recording toggle; defaults to the number's setting.
15346
15652
  */
15347
- email?: string;
15653
+ recordOverride?: boolean;
15348
15654
  /**
15349
- * Business websites (max 2)
15655
+ * Per-call transcription toggle; defaults to the number's setting.
15350
15656
  */
15351
- websites?: Array<(string)>;
15657
+ transcribeOverride?: boolean;
15352
15658
  /**
15353
- * Business category (e.g., RETAIL, ENTERTAINMENT, etc.)
15659
+ * 'auto' derives from the callee's country; 'en'/'es' force it.
15354
15660
  */
15355
- vertical?: string;
15661
+ transcriptionLanguage?: 'auto' | 'en' | 'es';
15356
15662
  /**
15357
- * Handle from resumable upload for profile picture
15663
+ * A retry with the same key returns the original call instead of dialing again.
15358
15664
  */
15359
- profilePictureHandle?: string;
15665
+ idempotencyKey?: string;
15666
+ /**
15667
+ * Answering-machine detection; defers the bridge until human vs machine is known.
15668
+ */
15669
+ amd?: boolean;
15670
+ /**
15671
+ * Spoken to a detected machine, then hang up (implies `amd`). For outbound voicemail drops.
15672
+ */
15673
+ voicemailDropMessage?: string;
15674
+ };
15675
+ headers?: {
15676
+ /**
15677
+ * Optional client-generated unique key (e.g. a UUID) that makes dial retries safe. Same key + same body replays the original response; same key + different body → 422; key still processing → 409.
15678
+ */
15679
+ 'Idempotency-Key'?: string;
15360
15680
  };
15361
15681
  };
15362
15682
 
15363
- export type UpdateWhatsAppBusinessProfileResponse = ({
15683
+ export type CreateVoiceCallResponse = ({
15364
15684
  success?: boolean;
15365
- message?: string;
15685
+ /**
15686
+ * Internal Call doc ID
15687
+ */
15688
+ callId?: string;
15689
+ telnyxCallControlId?: string;
15690
+ status?: 'dialing';
15691
+ direction?: 'outbound';
15692
+ from?: string;
15693
+ to?: string;
15694
+ forwardTo?: string;
15695
+ greeting?: (string) | null;
15696
+ recordingEnabled?: boolean;
15697
+ transcriptionEnabled?: boolean;
15698
+ transcriptionLanguage?: 'auto' | 'en' | 'es';
15366
15699
  });
15367
15700
 
15368
- export type UpdateWhatsAppBusinessProfileError = (unknown | {
15701
+ export type CreateVoiceCallError = ({
15369
15702
  error?: string;
15370
- });
15703
+ } | unknown);
15371
15704
 
15372
- export type UploadWhatsAppProfilePhotoData = {
15373
- body: {
15374
- /**
15375
- * WhatsApp social account ID
15376
- */
15377
- accountId: string;
15705
+ export type ListVoiceCallsData = {
15706
+ query?: {
15707
+ before?: string;
15708
+ direction?: 'inbound' | 'outbound';
15709
+ limit?: number;
15378
15710
  /**
15379
- * Image file (JPEG or PNG, max 5MB, recommended 640x640)
15711
+ * Exact filter: calls involving this number (typically one of your DIDs). E.164, leading + optional.
15380
15712
  */
15381
- file: (Blob | File);
15713
+ number?: string;
15714
+ status?: 'ringing' | 'answered' | 'ended' | 'failed';
15382
15715
  };
15383
15716
  };
15384
15717
 
15385
- export type UploadWhatsAppProfilePhotoResponse = ({
15386
- success?: boolean;
15387
- message?: string;
15718
+ export type ListVoiceCallsResponse = ({
15719
+ calls?: Array<CallRecord>;
15720
+ nextCursor?: (string) | null;
15388
15721
  });
15389
15722
 
15390
- export type UploadWhatsAppProfilePhotoError = (unknown | {
15723
+ export type ListVoiceCallsError = ({
15391
15724
  error?: string;
15392
15725
  });
15393
15726
 
15394
- export type GetWhatsAppDisplayNameData = {
15395
- query: {
15396
- /**
15397
- * WhatsApp social account ID
15398
- */
15399
- accountId: string;
15727
+ export type GetVoiceCallData = {
15728
+ path: {
15729
+ id: string;
15400
15730
  };
15401
15731
  };
15402
15732
 
15403
- export type GetWhatsAppDisplayNameResponse = ({
15733
+ export type GetVoiceCallResponse = ({
15734
+ call?: CallRecord;
15735
+ });
15736
+
15737
+ export type GetVoiceCallError = ({
15738
+ error?: string;
15739
+ } | unknown);
15740
+
15741
+ export type EndVoiceCallData = {
15742
+ path: {
15743
+ id: string;
15744
+ };
15745
+ };
15746
+
15747
+ export type EndVoiceCallResponse = ({
15404
15748
  success?: boolean;
15405
- displayName?: {
15406
- /**
15407
- * Current verified display name
15408
- */
15409
- name?: string;
15410
- /**
15411
- * Meta review status for the display name
15412
- */
15413
- status?: 'APPROVED' | 'PENDING_REVIEW' | 'DECLINED' | 'NONE';
15749
+ callId?: string;
15750
+ /**
15751
+ * `ending` when a hangup was issued; otherwise the call's current status.
15752
+ */
15753
+ status?: string;
15754
+ });
15755
+
15756
+ export type EndVoiceCallError = ({
15757
+ error?: string;
15758
+ } | unknown);
15759
+
15760
+ export type GetVoiceCallRecordingData = {
15761
+ path: {
15762
+ id: string;
15763
+ };
15764
+ query?: {
15414
15765
  /**
15415
- * Display phone number
15766
+ * `json` returns `{ url }` instead of a 302 redirect.
15416
15767
  */
15417
- phoneNumber?: string;
15768
+ as?: 'json';
15418
15769
  };
15770
+ };
15771
+
15772
+ export type GetVoiceCallRecordingResponse = ({
15773
+ url?: string;
15419
15774
  });
15420
15775
 
15421
- export type GetWhatsAppDisplayNameError = ({
15776
+ export type GetVoiceCallRecordingError = (unknown | {
15422
15777
  error?: string;
15423
- } | unknown);
15778
+ });
15424
15779
 
15425
- export type UpdateWhatsAppDisplayNameData = {
15780
+ export type TransferVoiceCallData = {
15426
15781
  body: {
15427
15782
  /**
15428
- * WhatsApp social account ID
15429
- */
15430
- accountId: string;
15431
- /**
15432
- * New display name (must follow WhatsApp naming guidelines)
15783
+ * +E164 phone number (tel: prefix optional) or a sip: URI. wss:// is not a valid transfer target.
15433
15784
  */
15434
- displayName: string;
15785
+ to: string;
15786
+ };
15787
+ path: {
15788
+ id: string;
15435
15789
  };
15436
15790
  };
15437
15791
 
15438
- export type UpdateWhatsAppDisplayNameResponse = ({
15792
+ export type TransferVoiceCallResponse = ({
15439
15793
  success?: boolean;
15440
- message?: string;
15441
- displayName?: {
15442
- name?: string;
15443
- status?: 'PENDING_REVIEW';
15444
- };
15794
+ callId?: string;
15795
+ transferredTo?: string;
15445
15796
  });
15446
15797
 
15447
- export type UpdateWhatsAppDisplayNameError = (unknown | {
15798
+ export type TransferVoiceCallError = ({
15448
15799
  error?: string;
15449
- });
15800
+ } | unknown);
15450
15801
 
15451
- export type GetWhatsappBusinessUsernameData = {
15802
+ export type GetVoiceCallEstimateData = {
15452
15803
  query: {
15804
+ minutes?: number;
15805
+ recording?: boolean;
15453
15806
  /**
15454
- * WhatsApp social account ID
15807
+ * Destination number, E.164 (leading + optional).
15455
15808
  */
15456
- accountId: string;
15809
+ to: string;
15810
+ transcription?: boolean;
15457
15811
  };
15458
15812
  };
15459
15813
 
15460
- export type GetWhatsappBusinessUsernameResponse = ({
15814
+ export type GetVoiceCallEstimateResponse = ({
15815
+ destinationCountry?: (string) | null;
15816
+ minutes?: number;
15817
+ /**
15818
+ * Billable cost per minute for the requested options.
15819
+ */
15820
+ perMinuteUsd?: number;
15821
+ breakdown?: {
15822
+ telnyxCostUSD?: number;
15823
+ recordingCostUSD?: number;
15824
+ transcriptionCostUSD?: number;
15825
+ /**
15826
+ * What Zernio bills for the call.
15827
+ */
15828
+ billableCostUSD?: number;
15829
+ /**
15830
+ * Equals billableCostUSD (no separate Meta bill on PSTN); kept for shape parity with the WhatsApp estimate.
15831
+ */
15832
+ totalCostUSD?: number;
15833
+ };
15834
+ });
15835
+
15836
+ export type GetVoiceCallEstimateError = ({
15837
+ error?: string;
15838
+ });
15839
+
15840
+ export type CreateVoiceWebSessionResponse = ({
15461
15841
  success?: boolean;
15462
15842
  /**
15463
- * The current username, or null if none is set
15843
+ * Login token for the browser WebRTC SDK.
15464
15844
  */
15465
- username?: (string) | null;
15845
+ token?: string;
15466
15846
  /**
15467
- * Approval state of the username
15847
+ * Pass to POST /v1/voice/calls/web/dial once the browser is registered.
15468
15848
  */
15469
- status?: 'approved' | 'reserved' | 'none';
15849
+ credentialId?: string;
15850
+ expiresAt?: string;
15851
+ sdk?: string;
15470
15852
  });
15471
15853
 
15472
- export type GetWhatsappBusinessUsernameError = ({
15854
+ export type CreateVoiceWebSessionError = ({
15473
15855
  error?: string;
15474
15856
  } | unknown);
15475
15857
 
15476
- export type SetWhatsappBusinessUsernameData = {
15858
+ export type DialVoiceWebCallData = {
15477
15859
  body: {
15478
15860
  /**
15479
- * WhatsApp social account ID
15861
+ * The number to call, E.164 with leading +.
15480
15862
  */
15481
- accountId: string;
15863
+ to: string;
15482
15864
  /**
15483
- * Desired username. Letters, digits, period, and underscore only. Must contain at least one letter. No leading, trailing, or consecutive periods. No www prefix. No domain TLD suffix.
15484
- *
15865
+ * The WebRTC credential id returned by POST /v1/voice/calls/web (the registered browser).
15485
15866
  */
15486
- username: string;
15867
+ credentialId: string;
15487
15868
  /**
15488
- * Pass `force_transfer` to request a transfer if the username is held by another account
15869
+ * Which of your voice-enabled numbers to call from (optional when you have one).
15489
15870
  */
15490
- transferAction?: 'none' | 'force_transfer';
15871
+ fromNumber?: string;
15872
+ recordOverride?: boolean;
15491
15873
  };
15492
15874
  };
15493
15875
 
15494
- export type SetWhatsappBusinessUsernameResponse = ({
15876
+ export type DialVoiceWebCallResponse = ({
15495
15877
  success?: boolean;
15496
- username?: string;
15497
- status?: 'approved' | 'reserved' | 'none';
15878
+ callId?: string;
15879
+ telnyxCallControlId?: string;
15880
+ status?: 'dialing';
15881
+ direction?: 'outbound';
15882
+ from?: string;
15883
+ to?: string;
15884
+ recordingEnabled?: boolean;
15498
15885
  });
15499
15886
 
15500
- export type SetWhatsappBusinessUsernameError = (unknown | {
15887
+ export type DialVoiceWebCallError = ({
15501
15888
  error?: string;
15502
- });
15889
+ } | unknown);
15503
15890
 
15504
- export type DeleteWhatsappBusinessUsernameData = {
15891
+ export type SendSmsData = {
15505
15892
  body: {
15506
15893
  /**
15507
- * WhatsApp social account ID
15894
+ * One of your SMS-enabled numbers (E.164; formatting is normalized).
15508
15895
  */
15509
- accountId: string;
15896
+ from: string;
15897
+ /**
15898
+ * Recipient number (E.164).
15899
+ */
15900
+ to: string;
15901
+ /**
15902
+ * Message body. Required unless `mediaUrls` is set. Max 10 SMS segments (1530 GSM-7 or 670 unicode characters).
15903
+ */
15904
+ text?: string;
15905
+ /**
15906
+ * Public media URLs to attach (sends as MMS). Max 10.
15907
+ */
15908
+ mediaUrls?: Array<(string)>;
15909
+ };
15910
+ headers?: {
15911
+ /**
15912
+ * Optional client-generated unique key (e.g. a UUID) that makes send retries safe. Same key + same body replays the original response; same key + different body → 422; key still processing → 409.
15913
+ */
15914
+ 'Idempotency-Key'?: string;
15510
15915
  };
15511
15916
  };
15512
15917
 
15513
- export type DeleteWhatsappBusinessUsernameResponse = ({
15514
- success?: boolean;
15918
+ export type SendSmsResponse = ({
15919
+ /**
15920
+ * Message ID
15921
+ */
15922
+ id?: string;
15923
+ /**
15924
+ * Inbox conversation the message was threaded into.
15925
+ */
15926
+ conversationId?: string;
15927
+ status?: 'sent';
15515
15928
  });
15516
15929
 
15517
- export type DeleteWhatsappBusinessUsernameError = ({
15930
+ export type SendSmsError = ({
15518
15931
  error?: string;
15519
15932
  } | unknown);
15520
15933
 
15521
- export type GetWhatsappBusinessUsernameSuggestionsData = {
15934
+ export type LookupSmsNumberData = {
15522
15935
  query: {
15523
15936
  /**
15524
- * WhatsApp social account ID
15937
+ * Number to look up (E.164; formatting is normalized).
15525
15938
  */
15526
- accountId: string;
15939
+ number: string;
15527
15940
  };
15528
15941
  };
15529
15942
 
15530
- export type GetWhatsappBusinessUsernameSuggestionsResponse = ({
15531
- success?: boolean;
15943
+ export type LookupSmsNumberResponse = ({
15944
+ phoneNumber?: string;
15945
+ carrierName?: (string) | null;
15946
+ lineType?: 'mobile' | 'landline' | 'voip' | 'toll-free' | 'unknown';
15532
15947
  /**
15533
- * List of available username suggestions
15948
+ * True when the line type can receive SMS (not a landline).
15534
15949
  */
15535
- suggestions?: Array<(string)>;
15950
+ smsReachable?: boolean;
15536
15951
  });
15537
15952
 
15538
- export type GetWhatsappBusinessUsernameSuggestionsError = ({
15953
+ export type LookupSmsNumberError = ({
15539
15954
  error?: string;
15540
15955
  } | unknown);
15541
15956
 
15542
- export type GetWhatsAppNumberInfoData = {
15543
- query: {
15544
- /**
15545
- * WhatsApp social account ID
15546
- */
15547
- accountId: string;
15957
+ export type ListSmsOptOutsData = {
15958
+ query?: {
15959
+ format?: 'json' | 'csv';
15960
+ limit?: number;
15548
15961
  };
15549
15962
  };
15550
15963
 
15551
- export type GetWhatsAppNumberInfoResponse = ({
15552
- phone?: {
15553
- display_phone_number?: string;
15554
- verified_name?: string;
15964
+ export type ListSmsOptOutsResponse = ({
15965
+ optOuts?: Array<{
15966
+ phoneNumber?: string;
15967
+ optedOutAt?: (string) | null;
15555
15968
  /**
15556
- * APPROVED, AVAILABLE_WITHOUT_REVIEW, PENDING_REVIEW, DECLINED, EXPIRED, NONE
15969
+ * The keyword they sent (e.g. STOP), when the carrier recorded one.
15557
15970
  */
15558
- name_status?: string;
15971
+ keyword?: (string) | null;
15559
15972
  /**
15560
- * GREEN, YELLOW, RED, UNKNOWN
15973
+ * Which of your numbers the recipient opted out from.
15561
15974
  */
15562
- quality_rating?: string;
15975
+ from?: (string) | null;
15976
+ }>;
15977
+ count?: number;
15978
+ });
15979
+
15980
+ export type ListSmsOptOutsError = ({
15981
+ error?: string;
15982
+ });
15983
+
15984
+ export type StartSmsRegistrationData = {
15985
+ body: {
15986
+ registrationType: 'standard_10dlc' | 'sole_prop_10dlc' | 'toll_free';
15563
15987
  /**
15564
- * e.g. TIER_250, TIER_1K, TIER_UNLIMITED
15988
+ * Your numbers this registration covers.
15565
15989
  */
15566
- messaging_limit_tier?: string;
15567
- throughput?: {
15990
+ phoneNumbers: Array<(string)>;
15991
+ /**
15992
+ * Required for 10DLC. The legal entity behind the traffic (TCR brand).
15993
+ */
15994
+ brand?: {
15995
+ entityType: 'PRIVATE_PROFIT' | 'PUBLIC_PROFIT' | 'NON_PROFIT' | 'GOVERNMENT' | 'SOLE_PROPRIETOR';
15996
+ displayName: string;
15568
15997
  /**
15569
- * STANDARD or HIGH
15998
+ * Legal company name. Required for every entityType except SOLE_PROPRIETOR.
15570
15999
  */
15571
- level?: string;
16000
+ companyName?: string;
16001
+ /**
16002
+ * Required for every entityType except SOLE_PROPRIETOR.
16003
+ */
16004
+ ein?: string;
16005
+ phone?: string;
16006
+ /**
16007
+ * Required for SOLE_PROPRIETOR; the verification OTP is texted there (US/CA mobile).
16008
+ */
16009
+ mobilePhone?: string;
16010
+ street?: string;
16011
+ city?: string;
16012
+ state?: string;
16013
+ postalCode?: string;
16014
+ country: 'US' | 'CA';
16015
+ /**
16016
+ * Brand contact email; defaults to your account email when omitted.
16017
+ */
16018
+ email?: string;
16019
+ website?: string;
16020
+ vertical: 'AGRICULTURE' | 'COMMUNICATION' | 'CONSTRUCTION' | 'EDUCATION' | 'ENERGY' | 'ENTERTAINMENT' | 'FINANCIAL' | 'GAMBLING' | 'GOVERNMENT' | 'HEALTHCARE' | 'HOSPITALITY' | 'HUMAN_RESOURCES' | 'INSURANCE' | 'LEGAL' | 'MANUFACTURING' | 'NGO' | 'POLITICAL' | 'POSTAL' | 'PROFESSIONAL' | 'REAL_ESTATE' | 'RETAIL' | 'TECHNOLOGY' | 'TRANSPORTATION';
16021
+ stockSymbol?: string;
15572
16022
  };
15573
16023
  /**
15574
- * e.g. CONNECTED
15575
- */
15576
- status?: string;
15577
- is_official_business_account?: boolean;
15578
- /**
15579
- * e.g. CLOUD_API
16024
+ * Required for 10DLC. What you'll send and how recipients opt in/out.
15580
16025
  */
15581
- platform_type?: string;
16026
+ campaign?: {
16027
+ usecase: string;
16028
+ description: string;
16029
+ /**
16030
+ * How a recipient ends up receiving your messages (the opt-in flow).
16031
+ */
16032
+ messageFlow: string;
16033
+ sample1: string;
16034
+ sample2?: string;
16035
+ helpMessage: string;
16036
+ optinKeywords: string;
16037
+ optinMessage: string;
16038
+ optoutKeywords: string;
16039
+ optoutMessage: string;
16040
+ helpKeywords: string;
16041
+ embeddedLink?: boolean;
16042
+ embeddedPhone?: boolean;
16043
+ numberPool?: boolean;
16044
+ ageGated?: boolean;
16045
+ directLending?: boolean;
16046
+ };
15582
16047
  /**
15583
- * Meta's can_send_message health object (messaging + calling signals)
16048
+ * Required for toll_free.
15584
16049
  */
15585
- health_status?: {
15586
- [key: string]: unknown;
16050
+ tollFree?: {
16051
+ businessName: string;
16052
+ corporateWebsite: string;
16053
+ phoneNumbers: Array<(string)>;
16054
+ useCase: string;
16055
+ useCaseSummary: string;
16056
+ productionMessageContent: string;
16057
+ /**
16058
+ * How recipients opt in to your messages.
16059
+ */
16060
+ optInWorkflow: string;
16061
+ /**
16062
+ * Screenshot URL(s) showing the opt-in flow (at least one).
16063
+ */
16064
+ optInWorkflowImageUrls: Array<(string)>;
16065
+ /**
16066
+ * Expected monthly message volume tier.
16067
+ */
16068
+ messageVolume: '10' | '100' | '1,000' | '10,000' | '100,000' | '250,000' | '500,000' | '750,000' | '1,000,000' | '5,000,000' | '10,000,000+';
16069
+ additionalInformation: string;
16070
+ businessAddr1: string;
16071
+ businessAddr2?: string;
16072
+ businessCity: string;
16073
+ businessState: string;
16074
+ businessZip: string;
16075
+ businessContactFirstName: string;
16076
+ businessContactLastName: string;
16077
+ businessContactEmail: string;
16078
+ businessContactPhone: string;
16079
+ businessRegistrationNumber: string;
16080
+ /**
16081
+ * e.g. EIN (US), Companies House (UK), ABN (AU).
16082
+ */
16083
+ businessRegistrationType: string;
16084
+ /**
16085
+ * ISO 3166-1 alpha-2.
16086
+ */
16087
+ businessRegistrationCountry: string;
15587
16088
  };
15588
16089
  };
15589
- waba?: {
15590
- name?: string;
16090
+ };
16091
+
16092
+ export type StartSmsRegistrationResponse = ({
16093
+ registrationId?: string;
16094
+ status?: 'pending';
16095
+ /**
16096
+ * True for sole-prop 10DLC: an OTP was texted to the brand's mobile; submit it via /verify-otp.
16097
+ */
16098
+ awaitingOtp?: boolean;
16099
+ });
16100
+
16101
+ export type StartSmsRegistrationError = ({
16102
+ error?: string;
16103
+ } | unknown);
16104
+
16105
+ export type ListSmsRegistrationsResponse = ({
16106
+ registrations?: Array<{
16107
+ id?: string;
16108
+ registrationType?: 'standard_10dlc' | 'sole_prop_10dlc' | 'toll_free';
16109
+ displayName?: (string) | null;
16110
+ status?: 'pending' | 'approved' | 'rejected';
15591
16111
  /**
15592
- * verified, not_verified, pending, ...
16112
+ * Carrier-registry brand status (e.g. VERIFIED).
15593
16113
  */
15594
- business_verification_status?: string;
16114
+ brandStatus?: string;
16115
+ campaignStatus?: string;
15595
16116
  /**
15596
- * Meta integer timezone-enum id
16117
+ * TCR brand id, useful when referencing the brand in carrier support threads.
15597
16118
  */
15598
- timezone_id?: string;
15599
- health_status?: {
15600
- [key: string]: unknown;
16119
+ brandId?: (string) | null;
16120
+ /**
16121
+ * TCR campaign id.
16122
+ */
16123
+ campaignId?: (string) | null;
16124
+ declineReason?: (string) | null;
16125
+ phoneNumbers?: Array<(string)>;
16126
+ /**
16127
+ * Sole-prop 10DLC only; the OTP step is still pending.
16128
+ */
16129
+ awaitingOtp?: boolean;
16130
+ /**
16131
+ * Carrier-assigned brand trust score; drives throughput.
16132
+ */
16133
+ trustScore?: (number) | null;
16134
+ /**
16135
+ * Carrier throughput tier derived from the trust score.
16136
+ */
16137
+ throughput?: {
16138
+ label?: string;
16139
+ smsPerMinute?: number;
16140
+ smsPerDay?: number;
15601
16141
  };
15602
- } | null;
16142
+ }>;
15603
16143
  });
15604
16144
 
15605
- export type GetWhatsAppNumberInfoError = (unknown | {
16145
+ export type ListSmsRegistrationsError = ({
15606
16146
  error?: string;
15607
16147
  });
15608
16148
 
15609
- export type GetWhatsAppBlockStatusData = {
15610
- query: {
15611
- accountId: string;
15612
- /**
15613
- * Consumer wa_id or E.164 phone (leading + optional)
15614
- */
15615
- user: string;
16149
+ export type GetSmsRegistrationData = {
16150
+ path: {
16151
+ id: string;
15616
16152
  };
15617
16153
  };
15618
16154
 
15619
- export type GetWhatsAppBlockStatusResponse = ({
15620
- blocked?: boolean;
16155
+ export type GetSmsRegistrationResponse = ({
16156
+ id?: string;
16157
+ registrationType?: 'standard_10dlc' | 'sole_prop_10dlc' | 'toll_free';
16158
+ status?: 'pending' | 'approved' | 'rejected';
16159
+ brandStatus?: string;
16160
+ campaignStatus?: string;
16161
+ declineReason?: (string) | null;
16162
+ phoneNumbers?: Array<(string)>;
16163
+ awaitingOtp?: boolean;
15621
16164
  });
15622
16165
 
15623
- export type GetWhatsAppBlockStatusError = ({
16166
+ export type GetSmsRegistrationError = ({
15624
16167
  error?: string;
15625
16168
  } | unknown);
15626
16169
 
15627
- export type GetWhatsAppBlockedUsersData = {
15628
- query: {
15629
- /**
15630
- * WhatsApp social account ID
15631
- */
15632
- accountId: string;
15633
- /**
15634
- * Cursor from a previous response's `nextCursor`.
15635
- */
15636
- after?: string;
15637
- /**
15638
- * Page size.
15639
- */
15640
- limit?: number;
16170
+ export type VerifySmsRegistrationOtpData = {
16171
+ body: {
16172
+ otpPin: string;
16173
+ };
16174
+ path: {
16175
+ id: string;
15641
16176
  };
15642
16177
  };
15643
16178
 
15644
- export type GetWhatsAppBlockedUsersResponse = ({
15645
- blockedUsers?: Array<{
15646
- /**
15647
- * WhatsApp user ID (usually the phone number without `+`).
15648
- */
15649
- waId?: string;
15650
- }>;
15651
- /**
15652
- * Pass as `after` to fetch the next page. Null when there are no more pages.
15653
- */
15654
- nextCursor?: (string) | null;
16179
+ export type VerifySmsRegistrationOtpResponse = ({
16180
+ verified?: boolean;
15655
16181
  });
15656
16182
 
15657
- export type GetWhatsAppBlockedUsersError = ({
16183
+ export type VerifySmsRegistrationOtpError = ({
15658
16184
  error?: string;
15659
16185
  } | unknown);
15660
16186
 
15661
- export type BlockWhatsAppUsersData = {
16187
+ export type AppealSmsRegistrationData = {
15662
16188
  body: {
15663
- /**
15664
- * WhatsApp social account ID
15665
- */
15666
- accountId: string;
15667
- /**
15668
- * Phone numbers (E.164, e.g. "+16505551234") or WhatsApp user IDs to block.
15669
- */
15670
- users: Array<(string)>;
16189
+ appealReason: string;
16190
+ };
16191
+ path: {
16192
+ id: string;
15671
16193
  };
15672
16194
  };
15673
16195
 
15674
- export type BlockWhatsAppUsersResponse = ({
15675
- /**
15676
- * Users successfully blocked.
15677
- */
15678
- blocked?: Array<{
15679
- /**
15680
- * The value you sent.
15681
- */
15682
- input?: string;
15683
- /**
15684
- * Resolved WhatsApp user ID.
15685
- */
15686
- waId?: string;
15687
- }>;
15688
- /**
15689
- * Users that could not be blocked, with reasons.
15690
- */
15691
- failed?: Array<{
15692
- input?: string;
15693
- errors?: Array<(string)>;
15694
- }>;
16196
+ export type AppealSmsRegistrationResponse = ({
16197
+ status?: 'pending';
15695
16198
  });
15696
16199
 
15697
- export type BlockWhatsAppUsersError = ({
16200
+ export type AppealSmsRegistrationError = (unknown | {
15698
16201
  error?: string;
15699
- } | unknown);
16202
+ });
15700
16203
 
15701
- export type UnblockWhatsAppUsersData = {
16204
+ export type ShareSmsRegistrationData = {
15702
16205
  body: {
15703
16206
  /**
15704
- * WhatsApp social account ID
15705
- */
15706
- accountId: string;
15707
- /**
15708
- * Phone numbers (E.164) or WhatsApp user IDs to unblock.
16207
+ * Your phone number's ID (from GET /v1/phone-numbers).
15709
16208
  */
15710
- users: Array<(string)>;
16209
+ numberId: string;
15711
16210
  };
15712
16211
  };
15713
16212
 
15714
- export type UnblockWhatsAppUsersResponse = ({
15715
- /**
15716
- * Users successfully unblocked.
15717
- */
15718
- unblocked?: Array<{
15719
- /**
15720
- * The value you sent.
15721
- */
15722
- input?: string;
15723
- /**
15724
- * Resolved WhatsApp user ID.
15725
- */
15726
- waId?: string;
15727
- }>;
15728
- /**
15729
- * Users that could not be unblocked, with reasons.
15730
- */
15731
- failed?: Array<{
15732
- input?: string;
15733
- errors?: Array<(string)>;
15734
- }>;
16213
+ export type ShareSmsRegistrationResponse = ({
16214
+ url?: string;
16215
+ expiresAt?: string;
15735
16216
  });
15736
16217
 
15737
- export type UnblockWhatsAppUsersError = ({
16218
+ export type ShareSmsRegistrationError = ({
15738
16219
  error?: string;
15739
16220
  } | unknown);
15740
16221
 
15741
- export type GetWhatsAppDatasetData = {
16222
+ export type GetWhatsAppLibraryTemplateData = {
15742
16223
  query: {
15743
16224
  /**
15744
16225
  * WhatsApp social account ID
15745
16226
  */
15746
16227
  accountId: string;
16228
+ /**
16229
+ * Exact library template name
16230
+ */
16231
+ name: string;
15747
16232
  };
15748
16233
  };
15749
16234
 
15750
- export type GetWhatsAppDatasetResponse = ({
15751
- /**
15752
- * Meta dataset ID linked to the WABA, or null if not provisioned yet
15753
- */
15754
- datasetId?: (string) | null;
16235
+ export type GetWhatsAppLibraryTemplateResponse = ({
16236
+ template?: {
16237
+ name?: string;
16238
+ language?: string;
16239
+ category?: string;
16240
+ body?: string;
16241
+ body_params?: Array<(string)>;
16242
+ buttons?: Array<{
16243
+ /**
16244
+ * QUICK_REPLY, URL, PHONE_NUMBER, OTP, FLOW, ...
16245
+ */
16246
+ type?: string;
16247
+ text?: string;
16248
+ }>;
16249
+ } | null;
15755
16250
  });
15756
16251
 
15757
- export type GetWhatsAppDatasetError = ({
16252
+ export type GetWhatsAppLibraryTemplateError = (unknown | {
15758
16253
  error?: string;
15759
- } | unknown);
16254
+ });
15760
16255
 
15761
- export type CreateWhatsAppDatasetData = {
15762
- body: {
16256
+ export type GetWhatsAppBusinessProfileData = {
16257
+ query: {
15763
16258
  /**
15764
16259
  * WhatsApp social account ID
15765
16260
  */
@@ -15767,247 +16262,1570 @@ export type CreateWhatsAppDatasetData = {
15767
16262
  };
15768
16263
  };
15769
16264
 
15770
- export type CreateWhatsAppDatasetResponse = ({
15771
- /**
15772
- * Meta dataset ID linked to the WABA
15773
- */
15774
- datasetId?: string;
15775
- /**
15776
- * True if Meta created a new dataset on this call; false if one already existed
15777
- */
15778
- created?: boolean;
15779
- });
15780
-
15781
- export type CreateWhatsAppDatasetError = ({
15782
- error?: string;
15783
- } | unknown);
15784
-
15785
- export type GetWhatsAppPhoneNumbersData = {
15786
- query?: {
16265
+ export type GetWhatsAppBusinessProfileResponse = ({
16266
+ success?: boolean;
16267
+ businessProfile?: {
16268
+ /**
16269
+ * Short description (max 139 chars)
16270
+ */
16271
+ about?: string;
16272
+ address?: string;
16273
+ /**
16274
+ * Full description (max 512 chars)
16275
+ */
16276
+ description?: string;
16277
+ email?: string;
16278
+ profilePictureUrl?: string;
16279
+ websites?: Array<(string)>;
16280
+ /**
16281
+ * Business category
16282
+ */
16283
+ vertical?: string;
16284
+ };
16285
+ });
16286
+
16287
+ export type GetWhatsAppBusinessProfileError = (unknown | {
16288
+ error?: string;
16289
+ });
16290
+
16291
+ export type UpdateWhatsAppBusinessProfileData = {
16292
+ body: {
16293
+ /**
16294
+ * WhatsApp social account ID
16295
+ */
16296
+ accountId: string;
16297
+ /**
16298
+ * Short business description (max 139 characters)
16299
+ */
16300
+ about?: string;
16301
+ /**
16302
+ * Business address
16303
+ */
16304
+ address?: string;
16305
+ /**
16306
+ * Full business description (max 512 characters)
16307
+ */
16308
+ description?: string;
16309
+ /**
16310
+ * Business email
16311
+ */
16312
+ email?: string;
16313
+ /**
16314
+ * Business websites (max 2)
16315
+ */
16316
+ websites?: Array<(string)>;
16317
+ /**
16318
+ * Business category (e.g., RETAIL, ENTERTAINMENT, etc.)
16319
+ */
16320
+ vertical?: string;
16321
+ /**
16322
+ * Handle from resumable upload for profile picture
16323
+ */
16324
+ profilePictureHandle?: string;
16325
+ };
16326
+ };
16327
+
16328
+ export type UpdateWhatsAppBusinessProfileResponse = ({
16329
+ success?: boolean;
16330
+ message?: string;
16331
+ });
16332
+
16333
+ export type UpdateWhatsAppBusinessProfileError = (unknown | {
16334
+ error?: string;
16335
+ });
16336
+
16337
+ export type UploadWhatsAppProfilePhotoData = {
16338
+ body: {
16339
+ /**
16340
+ * WhatsApp social account ID
16341
+ */
16342
+ accountId: string;
16343
+ /**
16344
+ * Image file (JPEG or PNG, max 5MB, recommended 640x640)
16345
+ */
16346
+ file: (Blob | File);
16347
+ };
16348
+ };
16349
+
16350
+ export type UploadWhatsAppProfilePhotoResponse = ({
16351
+ success?: boolean;
16352
+ message?: string;
16353
+ });
16354
+
16355
+ export type UploadWhatsAppProfilePhotoError = (unknown | {
16356
+ error?: string;
16357
+ });
16358
+
16359
+ export type GetWhatsAppDisplayNameData = {
16360
+ query: {
16361
+ /**
16362
+ * WhatsApp social account ID
16363
+ */
16364
+ accountId: string;
16365
+ };
16366
+ };
16367
+
16368
+ export type GetWhatsAppDisplayNameResponse = ({
16369
+ success?: boolean;
16370
+ displayName?: {
16371
+ /**
16372
+ * Current verified display name
16373
+ */
16374
+ name?: string;
16375
+ /**
16376
+ * Meta review status for the display name
16377
+ */
16378
+ status?: 'APPROVED' | 'PENDING_REVIEW' | 'DECLINED' | 'NONE';
16379
+ /**
16380
+ * Display phone number
16381
+ */
16382
+ phoneNumber?: string;
16383
+ };
16384
+ });
16385
+
16386
+ export type GetWhatsAppDisplayNameError = ({
16387
+ error?: string;
16388
+ } | unknown);
16389
+
16390
+ export type UpdateWhatsAppDisplayNameData = {
16391
+ body: {
16392
+ /**
16393
+ * WhatsApp social account ID
16394
+ */
16395
+ accountId: string;
16396
+ /**
16397
+ * New display name (must follow WhatsApp naming guidelines)
16398
+ */
16399
+ displayName: string;
16400
+ };
16401
+ };
16402
+
16403
+ export type UpdateWhatsAppDisplayNameResponse = ({
16404
+ success?: boolean;
16405
+ message?: string;
16406
+ displayName?: {
16407
+ name?: string;
16408
+ status?: 'PENDING_REVIEW';
16409
+ };
16410
+ });
16411
+
16412
+ export type UpdateWhatsAppDisplayNameError = (unknown | {
16413
+ error?: string;
16414
+ });
16415
+
16416
+ export type GetWhatsappBusinessUsernameData = {
16417
+ query: {
16418
+ /**
16419
+ * WhatsApp social account ID
16420
+ */
16421
+ accountId: string;
16422
+ };
16423
+ };
16424
+
16425
+ export type GetWhatsappBusinessUsernameResponse = ({
16426
+ success?: boolean;
16427
+ /**
16428
+ * The current username, or null if none is set
16429
+ */
16430
+ username?: (string) | null;
16431
+ /**
16432
+ * Approval state of the username
16433
+ */
16434
+ status?: 'approved' | 'reserved' | 'none';
16435
+ });
16436
+
16437
+ export type GetWhatsappBusinessUsernameError = ({
16438
+ error?: string;
16439
+ } | unknown);
16440
+
16441
+ export type SetWhatsappBusinessUsernameData = {
16442
+ body: {
16443
+ /**
16444
+ * WhatsApp social account ID
16445
+ */
16446
+ accountId: string;
16447
+ /**
16448
+ * Desired username. Letters, digits, period, and underscore only. Must contain at least one letter. No leading, trailing, or consecutive periods. No www prefix. No domain TLD suffix.
16449
+ *
16450
+ */
16451
+ username: string;
16452
+ /**
16453
+ * Pass `force_transfer` to request a transfer if the username is held by another account
16454
+ */
16455
+ transferAction?: 'none' | 'force_transfer';
16456
+ };
16457
+ };
16458
+
16459
+ export type SetWhatsappBusinessUsernameResponse = ({
16460
+ success?: boolean;
16461
+ username?: string;
16462
+ status?: 'approved' | 'reserved' | 'none';
16463
+ });
16464
+
16465
+ export type SetWhatsappBusinessUsernameError = (unknown | {
16466
+ error?: string;
16467
+ });
16468
+
16469
+ export type DeleteWhatsappBusinessUsernameData = {
16470
+ body: {
16471
+ /**
16472
+ * WhatsApp social account ID
16473
+ */
16474
+ accountId: string;
16475
+ };
16476
+ };
16477
+
16478
+ export type DeleteWhatsappBusinessUsernameResponse = ({
16479
+ success?: boolean;
16480
+ });
16481
+
16482
+ export type DeleteWhatsappBusinessUsernameError = ({
16483
+ error?: string;
16484
+ } | unknown);
16485
+
16486
+ export type GetWhatsappBusinessUsernameSuggestionsData = {
16487
+ query: {
16488
+ /**
16489
+ * WhatsApp social account ID
16490
+ */
16491
+ accountId: string;
16492
+ };
16493
+ };
16494
+
16495
+ export type GetWhatsappBusinessUsernameSuggestionsResponse = ({
16496
+ success?: boolean;
16497
+ /**
16498
+ * List of available username suggestions
16499
+ */
16500
+ suggestions?: Array<(string)>;
16501
+ });
16502
+
16503
+ export type GetWhatsappBusinessUsernameSuggestionsError = ({
16504
+ error?: string;
16505
+ } | unknown);
16506
+
16507
+ export type GetWhatsAppNumberInfoData = {
16508
+ query: {
16509
+ /**
16510
+ * WhatsApp social account ID
16511
+ */
16512
+ accountId: string;
16513
+ };
16514
+ };
16515
+
16516
+ export type GetWhatsAppNumberInfoResponse = ({
16517
+ phone?: {
16518
+ display_phone_number?: string;
16519
+ verified_name?: string;
16520
+ /**
16521
+ * APPROVED, AVAILABLE_WITHOUT_REVIEW, PENDING_REVIEW, DECLINED, EXPIRED, NONE
16522
+ */
16523
+ name_status?: string;
16524
+ /**
16525
+ * GREEN, YELLOW, RED, UNKNOWN
16526
+ */
16527
+ quality_rating?: string;
16528
+ /**
16529
+ * e.g. TIER_250, TIER_1K, TIER_UNLIMITED
16530
+ */
16531
+ messaging_limit_tier?: string;
16532
+ throughput?: {
16533
+ /**
16534
+ * STANDARD or HIGH
16535
+ */
16536
+ level?: string;
16537
+ };
16538
+ /**
16539
+ * e.g. CONNECTED
16540
+ */
16541
+ status?: string;
16542
+ is_official_business_account?: boolean;
16543
+ /**
16544
+ * e.g. CLOUD_API
16545
+ */
16546
+ platform_type?: string;
16547
+ /**
16548
+ * Meta's can_send_message health object (messaging + calling signals)
16549
+ */
16550
+ health_status?: {
16551
+ [key: string]: unknown;
16552
+ };
16553
+ };
16554
+ waba?: {
16555
+ name?: string;
16556
+ /**
16557
+ * verified, not_verified, pending, ...
16558
+ */
16559
+ business_verification_status?: string;
16560
+ /**
16561
+ * Meta integer timezone-enum id
16562
+ */
16563
+ timezone_id?: string;
16564
+ health_status?: {
16565
+ [key: string]: unknown;
16566
+ };
16567
+ } | null;
16568
+ });
16569
+
16570
+ export type GetWhatsAppNumberInfoError = (unknown | {
16571
+ error?: string;
16572
+ });
16573
+
16574
+ export type GetWhatsAppBlockStatusData = {
16575
+ query: {
16576
+ accountId: string;
16577
+ /**
16578
+ * Consumer wa_id or E.164 phone (leading + optional)
16579
+ */
16580
+ user: string;
16581
+ };
16582
+ };
16583
+
16584
+ export type GetWhatsAppBlockStatusResponse = ({
16585
+ blocked?: boolean;
16586
+ });
16587
+
16588
+ export type GetWhatsAppBlockStatusError = ({
16589
+ error?: string;
16590
+ } | unknown);
16591
+
16592
+ export type GetWhatsAppBlockedUsersData = {
16593
+ query: {
16594
+ /**
16595
+ * WhatsApp social account ID
16596
+ */
16597
+ accountId: string;
16598
+ /**
16599
+ * Cursor from a previous response's `nextCursor`.
16600
+ */
16601
+ after?: string;
16602
+ /**
16603
+ * Page size.
16604
+ */
16605
+ limit?: number;
16606
+ };
16607
+ };
16608
+
16609
+ export type GetWhatsAppBlockedUsersResponse = ({
16610
+ blockedUsers?: Array<{
16611
+ /**
16612
+ * WhatsApp user ID (usually the phone number without `+`).
16613
+ */
16614
+ waId?: string;
16615
+ }>;
16616
+ /**
16617
+ * Pass as `after` to fetch the next page. Null when there are no more pages.
16618
+ */
16619
+ nextCursor?: (string) | null;
16620
+ });
16621
+
16622
+ export type GetWhatsAppBlockedUsersError = ({
16623
+ error?: string;
16624
+ } | unknown);
16625
+
16626
+ export type BlockWhatsAppUsersData = {
16627
+ body: {
16628
+ /**
16629
+ * WhatsApp social account ID
16630
+ */
16631
+ accountId: string;
16632
+ /**
16633
+ * Phone numbers (E.164, e.g. "+16505551234") or WhatsApp user IDs to block.
16634
+ */
16635
+ users: Array<(string)>;
16636
+ };
16637
+ };
16638
+
16639
+ export type BlockWhatsAppUsersResponse = ({
16640
+ /**
16641
+ * Users successfully blocked.
16642
+ */
16643
+ blocked?: Array<{
16644
+ /**
16645
+ * The value you sent.
16646
+ */
16647
+ input?: string;
16648
+ /**
16649
+ * Resolved WhatsApp user ID.
16650
+ */
16651
+ waId?: string;
16652
+ }>;
16653
+ /**
16654
+ * Users that could not be blocked, with reasons.
16655
+ */
16656
+ failed?: Array<{
16657
+ input?: string;
16658
+ errors?: Array<(string)>;
16659
+ }>;
16660
+ });
16661
+
16662
+ export type BlockWhatsAppUsersError = ({
16663
+ error?: string;
16664
+ } | unknown);
16665
+
16666
+ export type UnblockWhatsAppUsersData = {
16667
+ body: {
16668
+ /**
16669
+ * WhatsApp social account ID
16670
+ */
16671
+ accountId: string;
16672
+ /**
16673
+ * Phone numbers (E.164) or WhatsApp user IDs to unblock.
16674
+ */
16675
+ users: Array<(string)>;
16676
+ };
16677
+ };
16678
+
16679
+ export type UnblockWhatsAppUsersResponse = ({
16680
+ /**
16681
+ * Users successfully unblocked.
16682
+ */
16683
+ unblocked?: Array<{
16684
+ /**
16685
+ * The value you sent.
16686
+ */
16687
+ input?: string;
16688
+ /**
16689
+ * Resolved WhatsApp user ID.
16690
+ */
16691
+ waId?: string;
16692
+ }>;
16693
+ /**
16694
+ * Users that could not be unblocked, with reasons.
16695
+ */
16696
+ failed?: Array<{
16697
+ input?: string;
16698
+ errors?: Array<(string)>;
16699
+ }>;
16700
+ });
16701
+
16702
+ export type UnblockWhatsAppUsersError = ({
16703
+ error?: string;
16704
+ } | unknown);
16705
+
16706
+ export type GetWhatsAppDatasetData = {
16707
+ query: {
16708
+ /**
16709
+ * WhatsApp social account ID
16710
+ */
16711
+ accountId: string;
16712
+ };
16713
+ };
16714
+
16715
+ export type GetWhatsAppDatasetResponse = ({
16716
+ /**
16717
+ * Meta dataset ID linked to the WABA, or null if not provisioned yet
16718
+ */
16719
+ datasetId?: (string) | null;
16720
+ });
16721
+
16722
+ export type GetWhatsAppDatasetError = ({
16723
+ error?: string;
16724
+ } | unknown);
16725
+
16726
+ export type CreateWhatsAppDatasetData = {
16727
+ body: {
16728
+ /**
16729
+ * WhatsApp social account ID
16730
+ */
16731
+ accountId: string;
16732
+ };
16733
+ };
16734
+
16735
+ export type CreateWhatsAppDatasetResponse = ({
16736
+ /**
16737
+ * Meta dataset ID linked to the WABA
16738
+ */
16739
+ datasetId?: string;
16740
+ /**
16741
+ * True if Meta created a new dataset on this call; false if one already existed
16742
+ */
16743
+ created?: boolean;
16744
+ });
16745
+
16746
+ export type CreateWhatsAppDatasetError = ({
16747
+ error?: string;
16748
+ } | unknown);
16749
+
16750
+ export type ListPhoneNumbersData = {
16751
+ query?: {
16752
+ /**
16753
+ * Filter by profile
16754
+ */
16755
+ profileId?: string;
16756
+ /**
16757
+ * Filter by status (by default excludes released numbers). NOTE:
16758
+ * `status=pending_regulatory` returns the "provisioning" view — numbers
16759
+ * still in review PLUS recently-declined (last 30 days) ones, so a
16760
+ * failed registration surfaces (with `regulatoryDeclineReason`) instead
16761
+ * of silently disappearing. Declined numbers can be re-submitted via
16762
+ * POST /v1/phone-numbers/{id}/remediate. `verifying` is the
16763
+ * short-lived state after the number is provisioned on our side while
16764
+ * WhatsApp confirms the activation code; the number is not billed until
16765
+ * it reaches `active`.
16766
+ *
16767
+ */
16768
+ status?: 'provisioning' | 'verifying' | 'pending_payment' | 'pending_regulatory' | 'regulatory_declined' | 'active' | 'suspended' | 'releasing' | 'released';
16769
+ };
16770
+ };
16771
+
16772
+ export type ListPhoneNumbersResponse = ({
16773
+ numbers?: Array<{
16774
+ _id?: string;
16775
+ phoneNumber?: string;
16776
+ country?: string;
16777
+ status?: 'pending_payment' | 'pending_regulatory' | 'regulatory_declined' | 'provisioning' | 'verifying' | 'active' | 'suspended' | 'releasing' | 'released';
16778
+ /**
16779
+ * For regulated numbers, who it's registered for (company or person) — set from the submitted KYC.
16780
+ */
16781
+ registrantName?: (string) | null;
16782
+ /**
16783
+ * Present once the number order has been placed (i.e. the requirement group was approved). Absent while still in identity review.
16784
+ */
16785
+ telnyxOrderId?: (string) | null;
16786
+ /**
16787
+ * Per-country monthly price in cents ($2..$25).
16788
+ */
16789
+ monthlyCents?: number;
16790
+ /**
16791
+ * False for numbers you brought yourself (connected via Meta embedded signup) — they live on your own carrier, so SMS/Calls can't be enabled on them.
16792
+ */
16793
+ hostedByZernio?: boolean;
16794
+ profileId?: {
16795
+ [key: string]: unknown;
16796
+ };
16797
+ provisionedAt?: string;
16798
+ metaPreverifiedId?: string;
16799
+ metaVerificationStatus?: string;
16800
+ /**
16801
+ * For regulated (Tier 3/4) numbers with an Onfido ID-verification step — the link to forward to the end user. Set once the order is placed; null otherwise. Poll this field after submitting KYC.
16802
+ */
16803
+ onfidoVerificationUrl?: (string) | null;
16804
+ endUserFirstName?: (string) | null;
16805
+ endUserLastName?: (string) | null;
16806
+ /**
16807
+ * Reviewer rejection reason when status is regulatory_declined.
16808
+ */
16809
+ regulatoryDeclineReason?: (string) | null;
16810
+ createdAt?: string;
16811
+ }>;
16812
+ /**
16813
+ * Connected (bring-your-own) WhatsApp numbers — your own WABA
16814
+ * numbers linked via Embedded Signup. Not provisioned or billed
16815
+ * by Zernio, so they are not in `numbers`; `accountId` is the
16816
+ * social-account id used by the messaging and inbox endpoints.
16817
+ * Included only on the default and `status=active` views.
16818
+ *
16819
+ */
16820
+ connected?: Array<{
16821
+ accountId?: string;
16822
+ phoneNumber?: (string) | null;
16823
+ displayName?: (string) | null;
16824
+ profileId?: (string) | null;
16825
+ connectedAt?: (string) | null;
16826
+ }>;
16827
+ /**
16828
+ * The shared WhatsApp sandbox (one Zernio-owned number, all users test
16829
+ * against it). Present when the sandbox is configured; null otherwise.
16830
+ * The `accountId` lets you address the sandbox in compose endpoints.
16831
+ * `template` is the only template a sandbox send is allowed to use.
16832
+ *
16833
+ */
16834
+ sandbox?: {
16835
+ phoneNumber?: string;
16836
+ accountId?: (string) | null;
16837
+ template?: {
16838
+ name?: string;
16839
+ language?: string;
16840
+ };
16841
+ isSandbox?: boolean;
16842
+ } | null;
16843
+ });
16844
+
16845
+ export type ListPhoneNumbersError = ({
16846
+ error?: string;
16847
+ });
16848
+
16849
+ export type GetPhoneNumberData = {
16850
+ path: {
16851
+ /**
16852
+ * Phone number record ID
16853
+ */
16854
+ id: string;
16855
+ };
16856
+ };
16857
+
16858
+ export type GetPhoneNumberResponse = ({
16859
+ phoneNumber?: {
16860
+ id?: string;
16861
+ phoneNumber?: string;
16862
+ status?: 'pending_payment' | 'pending_regulatory' | 'regulatory_declined' | 'provisioning' | 'verifying' | 'active' | 'suspended' | 'releasing' | 'released';
16863
+ country?: string;
16864
+ metaPreverifiedId?: string;
16865
+ metaVerificationStatus?: string;
16866
+ /**
16867
+ * For a regulated number with an Onfido ID step — the link to forward to the end user. Appears once the order is placed; null otherwise.
16868
+ */
16869
+ onfidoVerificationUrl?: (string) | null;
16870
+ endUserFirstName?: (string) | null;
16871
+ endUserLastName?: (string) | null;
16872
+ /**
16873
+ * Reviewer rejection reason when status is regulatory_declined.
16874
+ */
16875
+ regulatoryDeclineReason?: (string) | null;
16876
+ provisionedAt?: string;
16877
+ };
16878
+ });
16879
+
16880
+ export type GetPhoneNumberError = ({
16881
+ error?: string;
16882
+ });
16883
+
16884
+ export type ReleasePhoneNumberData = {
16885
+ path: {
16886
+ /**
16887
+ * Phone number record ID
16888
+ */
16889
+ id: string;
16890
+ };
16891
+ };
16892
+
16893
+ export type ReleasePhoneNumberResponse = ({
16894
+ message?: string;
16895
+ phoneNumber?: {
16896
+ id?: string;
16897
+ phoneNumber?: string;
16898
+ /**
16899
+ * "released"
16900
+ */
16901
+ status?: string;
16902
+ releasedAt?: string;
16903
+ };
16904
+ });
16905
+
16906
+ export type ReleasePhoneNumberError = (unknown | {
16907
+ error?: string;
16908
+ });
16909
+
16910
+ export type PurchasePhoneNumberData = {
16911
+ body: {
16912
+ /**
16913
+ * Profile to associate the number with
16914
+ */
16915
+ profileId: string;
16916
+ /**
16917
+ * ISO 3166-1 alpha-2 country for the number (default US). International numbers require usage-based billing. Tier 3/4 countries return 202 { status: "kyc_required", kycUrl } — the customer must complete KYC at that URL before the number is ordered. See GET /v1/phone-numbers/countries.
16918
+ *
16919
+ */
16920
+ country?: string;
16921
+ /**
16922
+ * A phone number is the unit; WhatsApp is one optional feature. Pass false to buy a STANDALONE number (Calls/SMS only): provisioning skips the Meta pre-verify/OTP steps and the number activates immediately. Omitted defaults to the WhatsApp provisioning path. WhatsApp can be connected to a standalone number later from the connect flow.
16923
+ *
16924
+ */
16925
+ connectWhatsapp?: boolean;
16926
+ /**
16927
+ * SMS capability is per-number, not per-country. Pass true to provision from the SMS-capable inventory pool so the number can actually text (see also GET /v1/phone-numbers/available with sms=true, and smsAvailable on GET /v1/phone-numbers/countries).
16928
+ *
16929
+ */
16930
+ wantsSms?: boolean;
16931
+ /**
16932
+ * Optional idempotency key. Send the same value when retrying a purchase: if a number was already bought under this key, the API returns { status: "already_purchased", numberId, phoneNumber } instead of provisioning a second number. Generate a fresh key for each genuinely new purchase.
16933
+ *
16934
+ */
16935
+ purchaseIntentId?: string;
16936
+ /**
16937
+ * Any second purchase within 10 minutes of a previous one is rejected with 409 code PURCHASE_VELOCITY as duplicate protection. Pass true to confirm the additional purchase is intentional (e.g. bulk provisioning).
16938
+ *
16939
+ */
16940
+ allowMultiple?: boolean;
16941
+ };
16942
+ };
16943
+
16944
+ export type PurchasePhoneNumberResponse = (({
16945
+ message?: string;
16946
+ checkoutUrl?: string;
16947
+ } | {
16948
+ message?: string;
16949
+ phoneNumber?: {
16950
+ id?: string;
16951
+ phoneNumber?: string;
16952
+ status?: string;
16953
+ country?: string;
16954
+ provisionedAt?: string;
16955
+ metaPreverifiedId?: string;
16956
+ metaVerificationStatus?: string;
16957
+ };
16958
+ } | {
16959
+ status?: 'already_purchased';
16960
+ numberId?: string;
16961
+ phoneNumber?: string;
16962
+ }) | {
16963
+ status?: 'kyc_required';
16964
+ country?: string;
16965
+ kycUrl?: string;
16966
+ });
16967
+
16968
+ export type PurchasePhoneNumberError = (unknown | {
16969
+ error?: string;
16970
+ } | {
16971
+ error?: string;
16972
+ code?: 'PURCHASE_VELOCITY';
16973
+ });
16974
+
16975
+ export type ListPhoneNumberCountriesResponse = ({
16976
+ countries?: Array<{
16977
+ /**
16978
+ * ISO 3166-1 alpha-2
16979
+ */
16980
+ code?: string;
16981
+ tier?: 1 | 2 | 3 | 4;
16982
+ monthlyCents?: number;
16983
+ needsKyc?: boolean;
16984
+ /**
16985
+ * Regular phone (PSTN) calling on the number, inbound + outbound. Available on every offerable country.
16986
+ */
16987
+ callsAvailable?: boolean;
16988
+ /**
16989
+ * WhatsApp can be enabled on numbers from this country.
16990
+ */
16991
+ whatsappAvailable?: boolean;
16992
+ /**
16993
+ * Whether this country's number type can do SMS. Use it to filter the picker when the buyer wants SMS (pair with `wantsSms` on purchase).
16994
+ */
16995
+ smsAvailable?: boolean;
16996
+ /**
16997
+ * WhatsApp Business Calling (BIC) outbound availability, a Meta feature blocked in some countries. NOT the PSTN Calls feature (`callsAvailable`).
16998
+ */
16999
+ outboundCallingAvailable?: boolean;
17000
+ }>;
17001
+ });
17002
+
17003
+ export type ListPhoneNumberCountriesError = ({
17004
+ error?: string;
17005
+ });
17006
+
17007
+ export type SearchAvailablePhoneNumbersData = {
17008
+ query?: {
17009
+ /**
17010
+ * Pattern to match within the number
17011
+ */
17012
+ contains?: string;
17013
+ country?: string;
17014
+ limit?: number;
17015
+ /**
17016
+ * City
17017
+ */
17018
+ locality?: string;
17019
+ /**
17020
+ * Area code
17021
+ */
17022
+ prefix?: string;
17023
+ /**
17024
+ * true narrows the pool to SMS-capable numbers. Each result still carries its full `features` list for per-number capability badging.
17025
+ */
17026
+ sms?: boolean;
17027
+ /**
17028
+ * Number type; defaults to the country's WhatsApp-safe type
17029
+ */
17030
+ type?: string;
17031
+ };
17032
+ };
17033
+
17034
+ export type SearchAvailablePhoneNumbersResponse = ({
17035
+ country?: string;
17036
+ numberType?: string;
17037
+ /**
17038
+ * Echo of the `sms` filter applied to this search.
17039
+ */
17040
+ requireSms?: boolean;
17041
+ numbers?: Array<{
17042
+ phoneNumber?: string;
17043
+ /**
17044
+ * Provider capability list for this number (e.g. voice, sms, mms).
17045
+ */
17046
+ features?: Array<(string)>;
17047
+ }>;
17048
+ });
17049
+
17050
+ export type SearchAvailablePhoneNumbersError = (unknown | {
17051
+ error?: string;
17052
+ });
17053
+
17054
+ export type CheckPhoneNumberAvailabilityData = {
17055
+ query: {
17056
+ /**
17057
+ * ISO-2 country code.
17058
+ */
17059
+ country: string;
17060
+ };
17061
+ };
17062
+
17063
+ export type CheckPhoneNumberAvailabilityResponse = ({
17064
+ country?: string;
17065
+ numberType?: string;
17066
+ /**
17067
+ * Whether deliverable voice inventory exists right now.
17068
+ */
17069
+ available?: boolean;
17070
+ addressConstraint?: 'geo' | 'country' | 'none';
17071
+ /**
17072
+ * For `geo` only — the area(s) the registered address must be in.
17073
+ */
17074
+ areas?: Array<(string)>;
17075
+ });
17076
+
17077
+ export type CheckPhoneNumberAvailabilityError = (unknown | {
17078
+ error?: string;
17079
+ });
17080
+
17081
+ export type GetWhatsAppPhoneNumbersData = {
17082
+ query?: {
15787
17083
  /**
15788
17084
  * Filter by profile
15789
17085
  */
15790
- profileId?: string;
17086
+ profileId?: string;
17087
+ /**
17088
+ * Filter by status (by default excludes released numbers). NOTE:
17089
+ * `status=pending_regulatory` returns the "provisioning" view — numbers
17090
+ * still in review PLUS recently-declined (last 30 days) ones, so a
17091
+ * failed registration surfaces (with `regulatoryDeclineReason`) instead
17092
+ * of silently disappearing. Declined numbers can be re-submitted via
17093
+ * POST /v1/whatsapp/phone-numbers/{id}/remediate. `verifying` is the
17094
+ * short-lived state after the number is provisioned on our side while
17095
+ * WhatsApp confirms the activation code; the number is not billed until
17096
+ * it reaches `active`.
17097
+ *
17098
+ */
17099
+ status?: 'provisioning' | 'verifying' | 'pending_payment' | 'pending_regulatory' | 'regulatory_declined' | 'active' | 'suspended' | 'releasing' | 'released';
17100
+ };
17101
+ };
17102
+
17103
+ export type GetWhatsAppPhoneNumbersResponse = ({
17104
+ numbers?: Array<{
17105
+ _id?: string;
17106
+ phoneNumber?: string;
17107
+ country?: string;
17108
+ status?: 'pending_payment' | 'pending_regulatory' | 'regulatory_declined' | 'provisioning' | 'verifying' | 'active' | 'suspended' | 'releasing' | 'released';
17109
+ /**
17110
+ * For regulated numbers, who it's registered for (company or person) — set from the submitted KYC.
17111
+ */
17112
+ registrantName?: (string) | null;
17113
+ /**
17114
+ * Present once the number order has been placed (i.e. the requirement group was approved). Absent while still in identity review.
17115
+ */
17116
+ telnyxOrderId?: (string) | null;
17117
+ /**
17118
+ * Per-country monthly price in cents ($2..$25).
17119
+ */
17120
+ monthlyCents?: number;
17121
+ /**
17122
+ * False for numbers you brought yourself (connected via Meta embedded signup) — they live on your own carrier, so SMS/Calls can't be enabled on them.
17123
+ */
17124
+ hostedByZernio?: boolean;
17125
+ profileId?: {
17126
+ [key: string]: unknown;
17127
+ };
17128
+ provisionedAt?: string;
17129
+ metaPreverifiedId?: string;
17130
+ metaVerificationStatus?: string;
17131
+ /**
17132
+ * For regulated (Tier 3/4) numbers with an Onfido ID-verification step — the link to forward to the end user. Set once the order is placed; null otherwise. Poll this field after submitting KYC.
17133
+ */
17134
+ onfidoVerificationUrl?: (string) | null;
17135
+ endUserFirstName?: (string) | null;
17136
+ endUserLastName?: (string) | null;
17137
+ /**
17138
+ * Reviewer rejection reason when status is regulatory_declined.
17139
+ */
17140
+ regulatoryDeclineReason?: (string) | null;
17141
+ createdAt?: string;
17142
+ }>;
17143
+ /**
17144
+ * Connected (bring-your-own) WhatsApp numbers — your own WABA
17145
+ * numbers linked via Embedded Signup. Not provisioned or billed
17146
+ * by Zernio, so they are not in `numbers`; `accountId` is the
17147
+ * social-account id used by the messaging and inbox endpoints.
17148
+ * Included only on the default and `status=active` views.
17149
+ *
17150
+ */
17151
+ connected?: Array<{
17152
+ accountId?: string;
17153
+ phoneNumber?: (string) | null;
17154
+ displayName?: (string) | null;
17155
+ profileId?: (string) | null;
17156
+ connectedAt?: (string) | null;
17157
+ }>;
17158
+ /**
17159
+ * The shared WhatsApp sandbox (one Zernio-owned number, all users test
17160
+ * against it). Present when the sandbox is configured; null otherwise.
17161
+ * The `accountId` lets you address the sandbox in compose endpoints.
17162
+ * `template` is the only template a sandbox send is allowed to use.
17163
+ *
17164
+ */
17165
+ sandbox?: {
17166
+ phoneNumber?: string;
17167
+ accountId?: (string) | null;
17168
+ template?: {
17169
+ name?: string;
17170
+ language?: string;
17171
+ };
17172
+ isSandbox?: boolean;
17173
+ } | null;
17174
+ });
17175
+
17176
+ export type GetWhatsAppPhoneNumbersError = ({
17177
+ error?: string;
17178
+ });
17179
+
17180
+ export type PurchaseWhatsAppPhoneNumberData = {
17181
+ body: {
17182
+ /**
17183
+ * Profile to associate the number with
17184
+ */
17185
+ profileId: string;
17186
+ /**
17187
+ * ISO 3166-1 alpha-2 country for the number (default US). International numbers require usage-based billing. Tier 3/4 countries return 202 { status: "kyc_required", kycUrl } — the customer must complete KYC at that URL before the number is ordered. See GET /v1/whatsapp/phone-numbers/countries.
17188
+ *
17189
+ */
17190
+ country?: string;
17191
+ /**
17192
+ * Optional idempotency key. Send the same value when retrying a purchase: if a number was already bought under this key, the API returns { status: "already_purchased", numberId, phoneNumber } instead of provisioning a second number. Generate a fresh key for each genuinely new purchase.
17193
+ *
17194
+ */
17195
+ purchaseIntentId?: string;
17196
+ /**
17197
+ * Any second purchase within 10 minutes of a previous one is rejected with 409 code PURCHASE_VELOCITY as duplicate protection. Pass true to confirm the additional purchase is intentional (e.g. bulk provisioning).
17198
+ *
17199
+ */
17200
+ allowMultiple?: boolean;
17201
+ };
17202
+ };
17203
+
17204
+ export type PurchaseWhatsAppPhoneNumberResponse = (({
17205
+ message?: string;
17206
+ checkoutUrl?: string;
17207
+ } | {
17208
+ message?: string;
17209
+ phoneNumber?: {
17210
+ id?: string;
17211
+ phoneNumber?: string;
17212
+ status?: string;
17213
+ country?: string;
17214
+ provisionedAt?: string;
17215
+ metaPreverifiedId?: string;
17216
+ metaVerificationStatus?: string;
17217
+ };
17218
+ } | {
17219
+ status?: 'already_purchased';
17220
+ numberId?: string;
17221
+ phoneNumber?: string;
17222
+ }) | {
17223
+ status?: 'kyc_required';
17224
+ country?: string;
17225
+ kycUrl?: string;
17226
+ });
17227
+
17228
+ export type PurchaseWhatsAppPhoneNumberError = (unknown | {
17229
+ error?: string;
17230
+ } | {
17231
+ error?: string;
17232
+ code?: 'PURCHASE_VELOCITY';
17233
+ });
17234
+
17235
+ export type ListWhatsAppNumberCountriesResponse = ({
17236
+ countries?: Array<{
17237
+ /**
17238
+ * ISO 3166-1 alpha-2
17239
+ */
17240
+ code?: string;
17241
+ tier?: 1 | 2 | 3 | 4;
17242
+ monthlyCents?: number;
17243
+ needsKyc?: boolean;
17244
+ outboundCallingAvailable?: boolean;
17245
+ }>;
17246
+ });
17247
+
17248
+ export type ListWhatsAppNumberCountriesError = ({
17249
+ error?: string;
17250
+ });
17251
+
17252
+ export type SearchAvailableWhatsAppNumbersData = {
17253
+ query?: {
17254
+ /**
17255
+ * Pattern to match within the number
17256
+ */
17257
+ contains?: string;
17258
+ country?: string;
17259
+ limit?: number;
17260
+ /**
17261
+ * City
17262
+ */
17263
+ locality?: string;
17264
+ /**
17265
+ * Area code
17266
+ */
17267
+ prefix?: string;
17268
+ /**
17269
+ * Number type; defaults to the country's WhatsApp-safe type
17270
+ */
17271
+ type?: string;
17272
+ };
17273
+ };
17274
+
17275
+ export type SearchAvailableWhatsAppNumbersResponse = ({
17276
+ country?: string;
17277
+ numberType?: string;
17278
+ numbers?: Array<{
17279
+ phoneNumber?: string;
17280
+ }>;
17281
+ });
17282
+
17283
+ export type SearchAvailableWhatsAppNumbersError = (unknown | {
17284
+ error?: string;
17285
+ });
17286
+
17287
+ export type CheckWhatsAppNumberAvailabilityData = {
17288
+ query: {
17289
+ /**
17290
+ * ISO-2 country code.
17291
+ */
17292
+ country: string;
17293
+ };
17294
+ };
17295
+
17296
+ export type CheckWhatsAppNumberAvailabilityResponse = ({
17297
+ country?: string;
17298
+ numberType?: string;
17299
+ /**
17300
+ * Whether deliverable voice inventory exists right now.
17301
+ */
17302
+ available?: boolean;
17303
+ addressConstraint?: 'geo' | 'country' | 'none';
17304
+ /**
17305
+ * For `geo` only — the area(s) the registered address must be in.
17306
+ */
17307
+ areas?: Array<(string)>;
17308
+ });
17309
+
17310
+ export type CheckWhatsAppNumberAvailabilityError = (unknown | {
17311
+ error?: string;
17312
+ });
17313
+
17314
+ export type GetPhoneNumberKycFormData = {
17315
+ query: {
17316
+ country: string;
17317
+ };
17318
+ };
17319
+
17320
+ export type GetPhoneNumberKycFormResponse = ({
17321
+ country?: string;
17322
+ numberType?: string;
17323
+ fields?: Array<{
17324
+ requirementId?: string;
17325
+ label?: string;
17326
+ /**
17327
+ * "action" = an out-of-band verification (e.g. Onfido); not filled here, fulfilled after the order via a link.
17328
+ */
17329
+ kind?: 'text' | 'date' | 'address' | 'file' | 'action';
17330
+ /**
17331
+ * Plain-English explanation of what to provide.
17332
+ */
17333
+ description?: (string) | null;
17334
+ /**
17335
+ * Concrete example value.
17336
+ */
17337
+ example?: (string) | null;
17338
+ /**
17339
+ * ISO country the value must be local to
17340
+ */
17341
+ localTo?: (string) | null;
17342
+ }>;
17343
+ /**
17344
+ * Present when this account already has an approved verification for the country that can be reused (skip the form). `fromPhoneNumber`/`details` mirror the newest option; `options` lists ALL approved verifications (agencies hold one per end client) — pass the chosen option's `fromPhoneNumber` as `reuseFrom` on POST.
17345
+ */
17346
+ reusable?: {
17347
+ available?: boolean;
17348
+ fromPhoneNumber?: string;
17349
+ /**
17350
+ * Human-readable summary of the verification on file (field labels + values, plus the address as one line). Best-effort — may be empty if the provider lookup fails.
17351
+ */
17352
+ details?: Array<{
17353
+ label?: string;
17354
+ value?: string;
17355
+ }>;
17356
+ /**
17357
+ * One entry per distinct approved verification, newest first.
17358
+ */
17359
+ options?: Array<{
17360
+ fromPhoneNumber?: string;
17361
+ details?: Array<{
17362
+ label?: string;
17363
+ value?: string;
17364
+ }>;
17365
+ }>;
17366
+ } | null;
17367
+ });
17368
+
17369
+ export type GetPhoneNumberKycFormError = (unknown | {
17370
+ error?: string;
17371
+ });
17372
+
17373
+ export type SubmitPhoneNumberKycData = {
17374
+ body: {
17375
+ profileId: string;
17376
+ country: string;
17377
+ /**
17378
+ * Idempotency token for this submission attempt. A retry/double-submit with the same token returns the same number; omit and each call creates a new number.
17379
+ */
17380
+ submissionId?: string;
17381
+ /**
17382
+ * Provision several same-country numbers from one submission (1-5). The single verification covers all of them; each number is billed only when it activates. Numbers that fail to order are skipped (best-effort).
17383
+ */
17384
+ quantity?: number;
17385
+ /**
17386
+ * Reuse a prior approved verification for this country (skips document/field collection; places the order immediately).
17387
+ */
17388
+ reuse?: boolean;
17389
+ /**
17390
+ * Which approved verification to reuse when several exist: the phone number it was originally approved for (GET reusable.options[].fromPhoneNumber). Omitted = newest. No match = 409.
17391
+ */
17392
+ reuseFrom?: string;
17393
+ /**
17394
+ * End user's legal first name. Required when the country has an action/ID-verification (Onfido) requirement.
17395
+ */
17396
+ endUserFirstName?: string;
17397
+ /**
17398
+ * End user's legal last name. Same condition as endUserFirstName.
17399
+ */
17400
+ endUserLastName?: string;
17401
+ /**
17402
+ * requirementId → textual value
17403
+ */
17404
+ values?: {
17405
+ [key: string]: (string);
17406
+ };
17407
+ /**
17408
+ * One per document requirement. Each is EITHER inline base64 OR a `documentId` returned by POST /v1/phone-numbers/kyc/upload-document (use the upload endpoint for large files to stay under the request-size limit).
17409
+ */
17410
+ documents?: Array<({
17411
+ requirementId: string;
17412
+ filename: string;
17413
+ base64: string;
17414
+ } | {
17415
+ requirementId: string;
17416
+ /**
17417
+ * Id from POST /v1/phone-numbers/kyc/upload-document.
17418
+ */
17419
+ documentId: string;
17420
+ })>;
17421
+ address?: {
17422
+ requirementId?: string;
17423
+ country_code?: string;
17424
+ business_name?: string;
17425
+ first_name?: string;
17426
+ last_name?: string;
17427
+ street_address?: string;
17428
+ locality?: string;
17429
+ administrative_area?: string;
17430
+ postal_code?: string;
17431
+ };
17432
+ };
17433
+ };
17434
+
17435
+ export type SubmitPhoneNumberKycResponse = ({
17436
+ status?: 'kyc_submitted' | 'kyc_reused' | 'kyc_already_submitted';
17437
+ /**
17438
+ * The first/primary number, kept at the top level for backward compatibility. See `numbers` for the full set when `quantity` > 1.
17439
+ */
17440
+ phoneNumber?: {
17441
+ id?: string;
17442
+ status?: string;
17443
+ country?: string;
17444
+ };
17445
+ /**
17446
+ * Every number provisioned from this submission. Length equals the requested `quantity` on full success (fewer if some orders failed; best-effort). The first element mirrors `phoneNumber`.
17447
+ */
17448
+ numbers?: Array<{
17449
+ id?: string;
17450
+ status?: string;
17451
+ phoneNumber?: string;
17452
+ country?: string;
17453
+ }>;
17454
+ });
17455
+
17456
+ export type SubmitPhoneNumberKycError = (unknown | {
17457
+ error?: string;
17458
+ });
17459
+
17460
+ export type UploadPhoneNumberKycDocumentData = {
17461
+ body: (Blob | File);
17462
+ headers: {
17463
+ /**
17464
+ * URL-encoded original filename.
17465
+ */
17466
+ 'X-Filename': string;
17467
+ };
17468
+ };
17469
+
17470
+ export type UploadPhoneNumberKycDocumentResponse = ({
17471
+ /**
17472
+ * Reference this id in the KYC submit's documents[].documentId.
17473
+ */
17474
+ documentId?: string;
17475
+ });
17476
+
17477
+ export type UploadPhoneNumberKycDocumentError = (unknown | {
17478
+ error?: string;
17479
+ });
17480
+
17481
+ export type ValidatePhoneNumberKycAddressData = {
17482
+ body: {
17483
+ /**
17484
+ * ISO 3166-1 alpha-2 country code.
17485
+ */
17486
+ country: string;
17487
+ street_address: string;
17488
+ /**
17489
+ * City / town.
17490
+ */
17491
+ locality: string;
17492
+ /**
17493
+ * State / province / region. When omitted, the pre-check is skipped (the final submit still validates).
17494
+ */
17495
+ administrative_area?: string;
17496
+ postal_code: string;
17497
+ };
17498
+ };
17499
+
17500
+ export type ValidatePhoneNumberKycAddressResponse = ({
17501
+ ok?: boolean;
17502
+ /**
17503
+ * true when no `administrative_area` was supplied, so no pre-check ran.
17504
+ */
17505
+ skipped?: boolean;
17506
+ });
17507
+
17508
+ export type ValidatePhoneNumberKycAddressError = ({
17509
+ /**
17510
+ * Human-readable message.
17511
+ */
17512
+ error?: string;
17513
+ type?: string;
17514
+ code?: string;
17515
+ param?: string;
17516
+ details?: {
17517
+ addressSuggestions?: Array<{
17518
+ field?: string;
17519
+ label?: string;
17520
+ value?: string;
17521
+ }>;
17522
+ };
17523
+ } | {
17524
+ error?: string;
17525
+ });
17526
+
17527
+ export type CreatePhoneNumberKycLinkData = {
17528
+ body: {
17529
+ profileId: string;
17530
+ /**
17531
+ * ISO 3166-1 alpha-2 country code (must be a regulated/KYC country).
17532
+ */
17533
+ country: string;
15791
17534
  /**
15792
- * Filter by status (by default excludes released numbers). NOTE:
15793
- * `status=pending_regulatory` returns the "provisioning" view — numbers
15794
- * still in review PLUS recently-declined (last 30 days) ones, so a
15795
- * failed registration surfaces (with `regulatoryDeclineReason`) instead
15796
- * of silently disappearing. Declined numbers can be re-submitted via
15797
- * POST /v1/whatsapp/phone-numbers/{id}/remediate. `verifying` is the
15798
- * short-lived state after the number is provisioned on our side while
15799
- * WhatsApp confirms the activation code; the number is not billed until
15800
- * it reaches `active`.
17535
+ * Optional white-label of the hosted page the end customer sees.
17536
+ */
17537
+ branding?: {
17538
+ /**
17539
+ * Your company name, shown on the hosted page.
17540
+ */
17541
+ companyName?: string;
17542
+ /**
17543
+ * Logo shown above the form.
17544
+ */
17545
+ logoUrl?: string;
17546
+ /**
17547
+ * Hex color (e.g. #1a73e8) used as a brand accent on the page.
17548
+ */
17549
+ brandColor?: string;
17550
+ };
17551
+ /**
17552
+ * Where to send the end customer's browser after a successful
17553
+ * submit. On completion Zernio appends `kyc=submitted` and
17554
+ * `country=<ISO-2>` as query params. When omitted, the hosted
17555
+ * page shows a built-in confirmation screen instead.
15801
17556
  *
15802
17557
  */
15803
- status?: 'provisioning' | 'verifying' | 'pending_payment' | 'pending_regulatory' | 'regulatory_declined' | 'active' | 'suspended' | 'releasing' | 'released';
17558
+ redirect_url?: string;
15804
17559
  };
15805
17560
  };
15806
17561
 
15807
- export type GetWhatsAppPhoneNumbersResponse = ({
15808
- numbers?: Array<{
15809
- _id?: string;
15810
- phoneNumber?: string;
15811
- country?: string;
15812
- status?: 'pending_payment' | 'pending_regulatory' | 'regulatory_declined' | 'provisioning' | 'verifying' | 'active' | 'suspended' | 'releasing' | 'released';
17562
+ export type CreatePhoneNumberKycLinkResponse = ({
17563
+ /**
17564
+ * The hosted link to send your end customer.
17565
+ */
17566
+ url?: string;
17567
+ token?: string;
17568
+ expiresAt?: string;
17569
+ });
17570
+
17571
+ export type CreatePhoneNumberKycLinkError = (unknown | {
17572
+ error?: string;
17573
+ });
17574
+
17575
+ export type CreatePhoneNumberPortInData = {
17576
+ body: {
15813
17577
  /**
15814
- * For regulated numbers, who it's registered for (company or person) — set from the submitted KYC.
17578
+ * E.164 numbers to port in.
15815
17579
  */
15816
- registrantName?: (string) | null;
17580
+ phoneNumbers: Array<(string)>;
15817
17581
  /**
15818
- * Present once the number order has been placed (i.e. the requirement group was approved). Absent while still in identity review.
17582
+ * End-user / current-carrier account info that authorizes the port.
15819
17583
  */
15820
- telnyxOrderId?: (string) | null;
17584
+ endUser: {
17585
+ entityName: string;
17586
+ authPersonName: string;
17587
+ billingPhoneNumber?: string;
17588
+ accountNumber?: string;
17589
+ /**
17590
+ * Transfer PIN. Forwarded to the carrier, never stored.
17591
+ */
17592
+ pinPasscode?: string;
17593
+ streetAddress: string;
17594
+ extendedAddress?: string;
17595
+ locality: string;
17596
+ administrativeArea: string;
17597
+ postalCode: string;
17598
+ countryCode: string;
17599
+ };
15821
17600
  /**
15822
- * Per-country monthly price in cents ($2..$25).
17601
+ * Document id from POST /v1/phone-numbers/port-in/documents (kind=loa).
15823
17602
  */
15824
- monthlyCents?: number;
15825
- profileId?: {
15826
- [key: string]: unknown;
15827
- };
15828
- provisionedAt?: string;
15829
- metaPreverifiedId?: string;
15830
- metaVerificationStatus?: string;
17603
+ loaDocumentId: string;
15831
17604
  /**
15832
- * For regulated (Tier 3/4) numbers with an Onfido ID-verification step — the link to forward to the end user. Set once the order is placed; null otherwise. Poll this field after submitting KYC.
17605
+ * Document id from POST /v1/phone-numbers/port-in/documents (kind=invoice).
15833
17606
  */
15834
- onfidoVerificationUrl?: (string) | null;
15835
- endUserFirstName?: (string) | null;
15836
- endUserLastName?: (string) | null;
17607
+ invoiceDocumentId: string;
15837
17608
  /**
15838
- * Reviewer rejection reason when status is regulatory_declined.
17609
+ * Requested port date; the carrier confirms the actual FOC later.
15839
17610
  */
15840
- regulatoryDeclineReason?: (string) | null;
15841
- createdAt?: string;
15842
- }>;
17611
+ focDatetimeRequested?: string;
17612
+ customerReference?: string;
17613
+ };
17614
+ };
17615
+
17616
+ export type CreatePhoneNumberPortInResponse = ({
15843
17617
  /**
15844
- * Connected (bring-your-own) WhatsApp numbers — your own WABA
15845
- * numbers linked via Embedded Signup. Not provisioned or billed
15846
- * by Zernio, so they are not in `numbers`; `accountId` is the
15847
- * social-account id used by the messaging and inbox endpoints.
15848
- * Included only on the default and `status=active` views.
15849
- *
17618
+ * Porting order ID.
15850
17619
  */
15851
- connected?: Array<{
15852
- accountId?: string;
15853
- phoneNumber?: (string) | null;
15854
- displayName?: (string) | null;
15855
- profileId?: (string) | null;
15856
- connectedAt?: (string) | null;
17620
+ id?: string;
17621
+ telnyxPortingOrderId?: string;
17622
+ status?: 'draft' | 'pending' | 'foc_confirmed' | 'ported' | 'exception' | 'cancelled';
17623
+ phoneNumbers?: Array<(string)>;
17624
+ orders?: Array<{
17625
+ id?: string;
17626
+ telnyxPortingOrderId?: string;
17627
+ status?: string;
17628
+ phoneNumbers?: Array<(string)>;
17629
+ /**
17630
+ * Present when this split order failed to submit (it stays as a cancellable draft).
17631
+ */
17632
+ error?: string;
15857
17633
  }>;
15858
- /**
15859
- * The shared WhatsApp sandbox (one Zernio-owned number, all users test
15860
- * against it). Present when the sandbox is configured; null otherwise.
15861
- * The `accountId` lets you address the sandbox in compose endpoints.
15862
- * `template` is the only template a sandbox send is allowed to use.
15863
- *
15864
- */
15865
- sandbox?: {
15866
- phoneNumber?: string;
15867
- accountId?: (string) | null;
15868
- template?: {
15869
- name?: string;
15870
- language?: string;
15871
- };
15872
- isSandbox?: boolean;
15873
- } | null;
15874
17634
  });
15875
17635
 
15876
- export type GetWhatsAppPhoneNumbersError = ({
17636
+ export type CreatePhoneNumberPortInError = ({
15877
17637
  error?: string;
17638
+ } | unknown);
17639
+
17640
+ export type ListPhoneNumberPortInsResponse = ({
17641
+ orders?: Array<{
17642
+ id?: string;
17643
+ status?: 'draft' | 'pending' | 'foc_confirmed' | 'ported' | 'exception' | 'cancelled';
17644
+ /**
17645
+ * Raw carrier status string.
17646
+ */
17647
+ telnyxStatusValue?: (string) | null;
17648
+ phoneNumbers?: Array<(string)>;
17649
+ fastPortEligible?: (boolean) | null;
17650
+ focDatetimeRequested?: (string) | null;
17651
+ focDatetimeActual?: (string) | null;
17652
+ declineReason?: (string) | null;
17653
+ submittedAt?: (string) | null;
17654
+ portedAt?: (string) | null;
17655
+ createdAt?: string;
17656
+ }>;
15878
17657
  });
15879
17658
 
15880
- export type PurchaseWhatsAppPhoneNumberData = {
17659
+ export type ListPhoneNumberPortInsError = ({
17660
+ error?: string;
17661
+ });
17662
+
17663
+ export type CheckPhoneNumberPortabilityData = {
15881
17664
  body: {
15882
17665
  /**
15883
- * Profile to associate the number with
17666
+ * E.164 numbers to check, e.g. +13035550000.
15884
17667
  */
15885
- profileId: string;
17668
+ phoneNumbers: Array<(string)>;
17669
+ };
17670
+ };
17671
+
17672
+ export type CheckPhoneNumberPortabilityResponse = ({
17673
+ results?: Array<{
17674
+ phoneNumber?: string;
17675
+ portable?: boolean;
15886
17676
  /**
15887
- * ISO 3166-1 alpha-2 country for the number (default US). International numbers require usage-based billing. Tier 3/4 countries return 202 { status: "kyc_required", kycUrl } — the customer must complete KYC at that URL before the number is ordered. See GET /v1/whatsapp/phone-numbers/countries.
15888
- *
17677
+ * Qualifies for the carrier's accelerated FastPort lane.
15889
17678
  */
15890
- country?: string;
17679
+ fastPortable?: boolean;
15891
17680
  /**
15892
- * Optional idempotency key. Send the same value when retrying a purchase: if a number was already bought under this key, the API returns { status: "already_purchased", numberId, phoneNumber } instead of provisioning a second number. Generate a fresh key for each genuinely new purchase.
15893
- *
17681
+ * Carrier reason when not portable; null when portable.
15894
17682
  */
15895
- purchaseIntentId?: string;
17683
+ notPortableReason?: (string) | null;
17684
+ }>;
17685
+ });
17686
+
17687
+ export type CheckPhoneNumberPortabilityError = ({
17688
+ error?: string;
17689
+ });
17690
+
17691
+ export type UploadPhoneNumberPortInDocumentData = {
17692
+ body: {
15896
17693
  /**
15897
- * Any second purchase within 10 minutes of a previous one is rejected with 409 code PURCHASE_VELOCITY as duplicate protection. Pass true to confirm the additional purchase is intentional (e.g. bulk provisioning).
15898
- *
17694
+ * The document (PDF/JPEG/PNG, 10MB max).
15899
17695
  */
15900
- allowMultiple?: boolean;
17696
+ file: (Blob | File);
17697
+ /**
17698
+ * Informational; used for the stored filename.
17699
+ */
17700
+ kind?: 'loa' | 'invoice';
15901
17701
  };
15902
17702
  };
15903
17703
 
15904
- export type PurchaseWhatsAppPhoneNumberResponse = (({
15905
- message?: string;
15906
- checkoutUrl?: string;
15907
- } | {
15908
- message?: string;
15909
- phoneNumber?: {
15910
- id?: string;
15911
- phoneNumber?: string;
15912
- status?: string;
15913
- country?: string;
15914
- provisionedAt?: string;
15915
- metaPreverifiedId?: string;
15916
- metaVerificationStatus?: string;
15917
- };
15918
- } | {
15919
- status?: 'already_purchased';
15920
- numberId?: string;
15921
- phoneNumber?: string;
15922
- }) | {
15923
- status?: 'kyc_required';
15924
- country?: string;
15925
- kycUrl?: string;
17704
+ export type UploadPhoneNumberPortInDocumentResponse = ({
17705
+ documentId?: string;
15926
17706
  });
15927
17707
 
15928
- export type PurchaseWhatsAppPhoneNumberError = (unknown | {
15929
- error?: string;
15930
- } | {
17708
+ export type UploadPhoneNumberPortInDocumentError = (unknown | {
15931
17709
  error?: string;
15932
- code?: 'PURCHASE_VELOCITY';
15933
17710
  });
15934
17711
 
15935
- export type ListWhatsAppNumberCountriesResponse = ({
15936
- countries?: Array<{
17712
+ export type CancelPhoneNumberPortInData = {
17713
+ path: {
15937
17714
  /**
15938
- * ISO 3166-1 alpha-2
17715
+ * Porting order ID (from the port-in list).
15939
17716
  */
15940
- code?: string;
15941
- tier?: 1 | 2 | 3 | 4;
15942
- monthlyCents?: number;
15943
- needsKyc?: boolean;
15944
- outboundCallingAvailable?: boolean;
15945
- }>;
17717
+ id: string;
17718
+ };
17719
+ };
17720
+
17721
+ export type CancelPhoneNumberPortInResponse = ({
17722
+ id?: string;
17723
+ status?: 'draft' | 'pending' | 'foc_confirmed' | 'ported' | 'exception' | 'cancelled';
15946
17724
  });
15947
17725
 
15948
- export type ListWhatsAppNumberCountriesError = ({
17726
+ export type CancelPhoneNumberPortInError = ({
15949
17727
  error?: string;
15950
- });
17728
+ } | unknown);
15951
17729
 
15952
- export type SearchAvailableWhatsAppNumbersData = {
15953
- query?: {
17730
+ export type ReviewPhoneNumberKycPacketData = {
17731
+ body: {
17732
+ country: string;
17733
+ numberType: string;
15954
17734
  /**
15955
- * Pattern to match within the number
17735
+ * requirementId to declared textual value.
15956
17736
  */
15957
- contains?: string;
15958
- country?: string;
15959
- limit?: number;
17737
+ values?: {
17738
+ [key: string]: (string);
17739
+ };
15960
17740
  /**
15961
- * City
17741
+ * Declared address (street_address, locality, ...), so a mismatched proof-of-address can be flagged.
15962
17742
  */
15963
- locality?: string;
17743
+ address?: {
17744
+ [key: string]: (string);
17745
+ };
17746
+ docs: Array<{
17747
+ requirementId: string;
17748
+ /**
17749
+ * Id from POST /v1/phone-numbers/kyc/upload-document.
17750
+ */
17751
+ documentId: string;
17752
+ }>;
17753
+ };
17754
+ };
17755
+
17756
+ export type ReviewPhoneNumberKycPacketResponse = ({
17757
+ advisories?: Array<{
17758
+ requirementId?: string;
15964
17759
  /**
15965
- * Area code
17760
+ * One short plain-language concern about that requirement's document.
15966
17761
  */
15967
- prefix?: string;
17762
+ concern?: string;
17763
+ }>;
17764
+ });
17765
+
17766
+ export type ReviewPhoneNumberKycPacketError = ({
17767
+ error?: string;
17768
+ });
17769
+
17770
+ export type GetPhoneNumberRemediationData = {
17771
+ path: {
15968
17772
  /**
15969
- * Number type; defaults to the country's WhatsApp-safe type
17773
+ * Phone number record ID.
15970
17774
  */
15971
- type?: string;
17775
+ id: string;
15972
17776
  };
15973
17777
  };
15974
17778
 
15975
- export type SearchAvailableWhatsAppNumbersResponse = ({
17779
+ export type GetPhoneNumberRemediationResponse = ({
15976
17780
  country?: string;
15977
17781
  numberType?: string;
15978
- numbers?: Array<{
15979
- phoneNumber?: string;
17782
+ declineReason?: (string) | null;
17783
+ /**
17784
+ * Same field shape as GET /v1/phone-numbers/kyc.
17785
+ */
17786
+ fields?: Array<{
17787
+ [key: string]: unknown;
15980
17788
  }>;
15981
17789
  });
15982
17790
 
15983
- export type SearchAvailableWhatsAppNumbersError = (unknown | {
17791
+ export type GetPhoneNumberRemediationError = (unknown | {
15984
17792
  error?: string;
15985
17793
  });
15986
17794
 
15987
- export type CheckWhatsAppNumberAvailabilityData = {
15988
- query: {
17795
+ export type RemediatePhoneNumberData = {
17796
+ body: {
17797
+ values?: {
17798
+ [key: string]: (string);
17799
+ };
17800
+ documents?: Array<({
17801
+ requirementId: string;
17802
+ filename: string;
17803
+ base64: string;
17804
+ } | {
17805
+ requirementId: string;
17806
+ documentId: string;
17807
+ })>;
15989
17808
  /**
15990
- * ISO-2 country code.
17809
+ * Same shape as the KYC submit address.
15991
17810
  */
15992
- country: string;
17811
+ address?: {
17812
+ [key: string]: unknown;
17813
+ };
17814
+ };
17815
+ path: {
17816
+ id: string;
15993
17817
  };
15994
17818
  };
15995
17819
 
15996
- export type CheckWhatsAppNumberAvailabilityResponse = ({
15997
- country?: string;
15998
- numberType?: string;
15999
- /**
16000
- * Whether deliverable voice inventory exists right now.
16001
- */
16002
- available?: boolean;
16003
- addressConstraint?: 'geo' | 'country' | 'none';
16004
- /**
16005
- * For `geo` only — the area(s) the registered address must be in.
16006
- */
16007
- areas?: Array<(string)>;
17820
+ export type RemediatePhoneNumberResponse = ({
17821
+ status?: string;
17822
+ phoneNumber?: {
17823
+ id?: string;
17824
+ status?: string;
17825
+ };
16008
17826
  });
16009
17827
 
16010
- export type CheckWhatsAppNumberAvailabilityError = (unknown | {
17828
+ export type RemediatePhoneNumberError = (unknown | {
16011
17829
  error?: string;
16012
17830
  });
16013
17831
 
@@ -16339,6 +18157,312 @@ export type RemediateWhatsAppNumberError = (unknown | {
16339
18157
  error?: string;
16340
18158
  });
16341
18159
 
18160
+ export type EnableVoiceOnNumberData = {
18161
+ body?: {
18162
+ /**
18163
+ * tel:+E164, sip:..., or wss://... destination for inbound calls. Empty string clears the forward (outbound-only); omitted preserves the current one.
18164
+ */
18165
+ forwardTo?: string;
18166
+ recordingEnabled?: boolean;
18167
+ transcriptionEnabled?: boolean;
18168
+ transcriptionLanguage?: 'auto' | 'en' | 'es';
18169
+ /**
18170
+ * Voicemail is taken when there's no live destination. Default on.
18171
+ */
18172
+ voicemailEnabled?: boolean;
18173
+ /**
18174
+ * Custom spoken greeting; empty string restores the default.
18175
+ */
18176
+ voicemailGreeting?: string;
18177
+ /**
18178
+ * Outside the windows, inbound skips the forward and goes to voicemail. Off = 24/7.
18179
+ */
18180
+ businessHoursEnabled?: boolean;
18181
+ /**
18182
+ * IANA timezone the windows are evaluated in.
18183
+ */
18184
+ businessHoursTimezone?: string;
18185
+ businessHours?: Array<{
18186
+ /**
18187
+ * 0 = Sunday.
18188
+ */
18189
+ day: number;
18190
+ open: string;
18191
+ close: string;
18192
+ }>;
18193
+ /**
18194
+ * E.164 numbers rejected before answer. Replaces the whole list; bare 10-digit values are normalized as US numbers.
18195
+ */
18196
+ blockedCallers?: Array<(string)>;
18197
+ /**
18198
+ * Caller ID on the forwarded leg: your number (`business`) or the original caller's (`caller`).
18199
+ */
18200
+ forwardCallerId?: 'business' | 'caller';
18201
+ /**
18202
+ * IVR menu (supersedes the plain forward within business hours).
18203
+ */
18204
+ ivrEnabled?: boolean;
18205
+ ivrPrompt?: string;
18206
+ ivrOptions?: Array<{
18207
+ digit: string;
18208
+ /**
18209
+ * tel:+E164, sip:..., or wss://... destination for this digit.
18210
+ */
18211
+ forwardTo: string;
18212
+ label?: string;
18213
+ }>;
18214
+ };
18215
+ path: {
18216
+ /**
18217
+ * Phone number record ID (from GET /v1/phone-numbers).
18218
+ */
18219
+ id: string;
18220
+ };
18221
+ };
18222
+
18223
+ export type EnableVoiceOnNumberResponse = ({
18224
+ enabled?: boolean;
18225
+ phoneNumber?: string;
18226
+ pstnForwardTo?: (string) | null;
18227
+ recordingEnabled?: boolean;
18228
+ transcriptionEnabled?: boolean;
18229
+ transcriptionLanguage?: 'auto' | 'en' | 'es';
18230
+ voicemailEnabled?: boolean;
18231
+ voicemailGreeting?: (string) | null;
18232
+ businessHoursEnabled?: boolean;
18233
+ businessHoursTimezone?: (string) | null;
18234
+ businessHours?: Array<{
18235
+ day?: number;
18236
+ open?: string;
18237
+ close?: string;
18238
+ }>;
18239
+ blockedCallers?: Array<(string)>;
18240
+ forwardCallerId?: 'business' | 'caller';
18241
+ ivrEnabled?: boolean;
18242
+ ivrPrompt?: (string) | null;
18243
+ ivrOptions?: Array<{
18244
+ digit?: string;
18245
+ forwardTo?: string;
18246
+ label?: string;
18247
+ }>;
18248
+ });
18249
+
18250
+ export type EnableVoiceOnNumberError = ({
18251
+ error?: string;
18252
+ } | unknown);
18253
+
18254
+ export type DisableVoiceOnNumberData = {
18255
+ path: {
18256
+ id: string;
18257
+ };
18258
+ };
18259
+
18260
+ export type DisableVoiceOnNumberResponse = ({
18261
+ enabled?: boolean;
18262
+ phoneNumber?: string;
18263
+ });
18264
+
18265
+ export type DisableVoiceOnNumberError = ({
18266
+ error?: string;
18267
+ } | unknown);
18268
+
18269
+ export type EnableSmsOnNumberData = {
18270
+ path: {
18271
+ /**
18272
+ * Phone number record ID (from GET /v1/phone-numbers).
18273
+ */
18274
+ id: string;
18275
+ };
18276
+ };
18277
+
18278
+ export type EnableSmsOnNumberResponse = ({
18279
+ enabled?: boolean;
18280
+ /**
18281
+ * The SMS social account ID (present when enabled).
18282
+ */
18283
+ id?: string;
18284
+ phoneNumber?: string;
18285
+ /**
18286
+ * False for US numbers until their registration is approved.
18287
+ */
18288
+ isActive?: boolean;
18289
+ country?: string;
18290
+ /**
18291
+ * Null when capability can't be read yet (still provisioning).
18292
+ */
18293
+ smsCapable?: (boolean) | null;
18294
+ mmsCapable?: boolean;
18295
+ domesticOnly?: boolean;
18296
+ /**
18297
+ * Number is still provisioning at the carrier; retry shortly.
18298
+ */
18299
+ notReady?: boolean;
18300
+ /**
18301
+ * US only; a carrier registration is required before delivery.
18302
+ */
18303
+ needsRegistration?: boolean;
18304
+ /**
18305
+ * A prior non-rejected registration already covers this number; no re-submit needed.
18306
+ */
18307
+ alreadyRegistered?: boolean;
18308
+ registrationStatus?: ('pending' | 'approved' | 'rejected') | null;
18309
+ /**
18310
+ * Present when an existing approved registration can cover this number via /sms/reuse-registration.
18311
+ */
18312
+ reusable?: {
18313
+ registrationId?: string;
18314
+ status?: string;
18315
+ } | null;
18316
+ /**
18317
+ * Human-readable explanation when `enabled` is false.
18318
+ */
18319
+ message?: string;
18320
+ });
18321
+
18322
+ export type EnableSmsOnNumberError = ({
18323
+ error?: string;
18324
+ } | unknown);
18325
+
18326
+ export type DisableSmsOnNumberData = {
18327
+ path: {
18328
+ id: string;
18329
+ };
18330
+ };
18331
+
18332
+ export type DisableSmsOnNumberResponse = ({
18333
+ enabled?: boolean;
18334
+ phoneNumber?: string;
18335
+ /**
18336
+ * False when SMS was already off. Legacy field; prefer `enabled`.
18337
+ */
18338
+ disabled?: boolean;
18339
+ });
18340
+
18341
+ export type DisableSmsOnNumberError = ({
18342
+ error?: string;
18343
+ } | unknown);
18344
+
18345
+ export type ReuseSmsRegistrationForNumberData = {
18346
+ path: {
18347
+ id: string;
18348
+ };
18349
+ };
18350
+
18351
+ export type ReuseSmsRegistrationForNumberResponse = ({
18352
+ registrationId?: string;
18353
+ status?: 'pending' | 'approved' | 'rejected';
18354
+ });
18355
+
18356
+ export type ReuseSmsRegistrationForNumberError = ({
18357
+ error?: string;
18358
+ } | unknown);
18359
+
18360
+ export type GetWhatsAppCallingData = {
18361
+ path: {
18362
+ /**
18363
+ * Phone number record ID (from GET /v1/phone-numbers).
18364
+ */
18365
+ id: string;
18366
+ };
18367
+ };
18368
+
18369
+ export type GetWhatsAppCallingResponse = ({
18370
+ phoneNumber?: string;
18371
+ callingEnabled?: boolean;
18372
+ /**
18373
+ * Public calling deep link (https://wa.me/call/<number>). Null while calling is disabled.
18374
+ */
18375
+ callDeepLink?: (string) | null;
18376
+ /**
18377
+ * tel:+E164 / sip:... / wss://... destination
18378
+ */
18379
+ forwardTo?: (string) | null;
18380
+ recordingEnabled?: boolean;
18381
+ sipAuthUsername?: (string) | null;
18382
+ /**
18383
+ * True when a SIP digest password is stored. The plaintext is never returned.
18384
+ */
18385
+ sipAuthPasswordConfigured?: boolean;
18386
+ callIconCountries?: Array<(string)> | null;
18387
+ /**
18388
+ * True when the number's country blocks business-initiated (outbound) WhatsApp calling; inbound still works.
18389
+ */
18390
+ outboundDisabled?: boolean;
18391
+ });
18392
+
18393
+ export type GetWhatsAppCallingError = ({
18394
+ error?: string;
18395
+ } | unknown);
18396
+
18397
+ export type EnableWhatsAppCallingData = {
18398
+ body: {
18399
+ accountId: string;
18400
+ /**
18401
+ * tel:+E164 / sip:... / wss://... destination
18402
+ */
18403
+ forwardTo: string;
18404
+ sipAuthUsername?: string;
18405
+ /**
18406
+ * Stored encrypted, never returned by any endpoint.
18407
+ */
18408
+ sipAuthPassword?: string;
18409
+ recordingEnabled?: boolean;
18410
+ callIconCountries?: Array<(string)>;
18411
+ };
18412
+ path: {
18413
+ /**
18414
+ * Phone number record ID (from GET /v1/phone-numbers).
18415
+ */
18416
+ id: string;
18417
+ };
18418
+ };
18419
+
18420
+ export type EnableWhatsAppCallingResponse = ({
18421
+ success?: boolean;
18422
+ callingEnabled?: boolean;
18423
+ sipHostname?: string;
18424
+ forwardTo?: string;
18425
+ });
18426
+
18427
+ export type EnableWhatsAppCallingError = ({
18428
+ error?: string;
18429
+ } | unknown);
18430
+
18431
+ export type UpdateWhatsAppCallingData = {
18432
+ body: {
18433
+ accountId: string;
18434
+ forwardTo?: string;
18435
+ sipAuthUsername?: (string) | null;
18436
+ sipAuthPassword?: (string) | null;
18437
+ recordingEnabled?: boolean;
18438
+ callIconCountries?: Array<(string)> | null;
18439
+ };
18440
+ path: {
18441
+ id: string;
18442
+ };
18443
+ };
18444
+
18445
+ export type UpdateWhatsAppCallingResponse = (unknown);
18446
+
18447
+ export type UpdateWhatsAppCallingError = ({
18448
+ error?: string;
18449
+ } | unknown);
18450
+
18451
+ export type DisableWhatsAppCallingData = {
18452
+ path: {
18453
+ id: string;
18454
+ };
18455
+ query: {
18456
+ accountId: string;
18457
+ };
18458
+ };
18459
+
18460
+ export type DisableWhatsAppCallingResponse = (unknown);
18461
+
18462
+ export type DisableWhatsAppCallingError = ({
18463
+ error?: string;
18464
+ } | unknown);
18465
+
16342
18466
  export type GetWhatsAppPhoneNumberData = {
16343
18467
  path: {
16344
18468
  /**