zernio-sdk 0.0.537 → 0.0.539

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -0
  3. data/docs/CheckVerification200Response.md +40 -0
  4. data/docs/CheckVerificationRequest.md +18 -0
  5. data/docs/CreateVerificationRequest.md +28 -0
  6. data/docs/OnVerificationApprovedRequest.md +24 -0
  7. data/docs/OnVerificationApprovedRequestVerification.md +22 -0
  8. data/docs/OnVerificationFailedRequest.md +26 -0
  9. data/docs/OnVerificationFailedRequestVerification.md +22 -0
  10. data/docs/Verification.md +38 -0
  11. data/docs/VerifyApi.md +219 -0
  12. data/docs/WebhookEventsApi.md +138 -0
  13. data/lib/zernio-sdk/api/verify_api.rb +227 -0
  14. data/lib/zernio-sdk/api/webhook_events_api.rb +132 -0
  15. data/lib/zernio-sdk/models/check_verification200_response.rb +301 -0
  16. data/lib/zernio-sdk/models/check_verification_request.rb +175 -0
  17. data/lib/zernio-sdk/models/create_verification_request.rb +333 -0
  18. data/lib/zernio-sdk/models/on_verification_approved_request.rb +208 -0
  19. data/lib/zernio-sdk/models/on_verification_approved_request_verification.rb +199 -0
  20. data/lib/zernio-sdk/models/on_verification_failed_request.rb +229 -0
  21. data/lib/zernio-sdk/models/on_verification_failed_request_verification.rb +199 -0
  22. data/lib/zernio-sdk/models/on_whats_app_number_kyc_submitted_request.rb +2 -2
  23. data/lib/zernio-sdk/models/verification.rb +287 -0
  24. data/lib/zernio-sdk/version.rb +1 -1
  25. data/lib/zernio-sdk.rb +9 -0
  26. data/openapi.yaml +205 -5
  27. data/spec/api/verify_api_spec.rb +72 -0
  28. data/spec/models/check_verification200_response_spec.rb +110 -0
  29. data/spec/models/check_verification_request_spec.rb +36 -0
  30. data/spec/models/create_verification_request_spec.rb +70 -0
  31. data/spec/models/create_webhook_settings_request_spec.rb +1 -1
  32. data/spec/models/on_verification_approved_request_spec.rb +58 -0
  33. data/spec/models/on_verification_approved_request_verification_spec.rb +52 -0
  34. data/spec/models/on_verification_failed_request_spec.rb +68 -0
  35. data/spec/models/on_verification_failed_request_verification_spec.rb +52 -0
  36. data/spec/models/on_whats_app_number_kyc_submitted_request_spec.rb +1 -1
  37. data/spec/models/update_webhook_settings_request_spec.rb +1 -1
  38. data/spec/models/verification_spec.rb +104 -0
  39. data/spec/models/webhook_spec.rb +1 -1
  40. metadata +37 -1
@@ -0,0 +1,287 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Zernio
17
+ # A managed OTP verification. The code itself is never returned or stored (hash only).
18
+ class Verification < ApiModelBase
19
+ attr_accessor :id
20
+
21
+ attr_accessor :status
22
+
23
+ attr_accessor :channel
24
+
25
+ attr_accessor :to
26
+
27
+ attr_accessor :expires_at
28
+
29
+ attr_accessor :attempts
30
+
31
+ attr_accessor :max_attempts
32
+
33
+ # Accepted deliveries (initial send + resends); each bills one verification fee.
34
+ attr_accessor :send_count
35
+
36
+ attr_accessor :last_sent_at
37
+
38
+ attr_accessor :created_at
39
+
40
+ # Present on create responses: true when an active verification was resent instead of created.
41
+ attr_accessor :resend
42
+
43
+ class EnumAttributeValidator
44
+ attr_reader :datatype
45
+ attr_reader :allowable_values
46
+
47
+ def initialize(datatype, allowable_values)
48
+ @allowable_values = allowable_values.map do |value|
49
+ case datatype.to_s
50
+ when /Integer/i
51
+ value.to_i
52
+ when /Float/i
53
+ value.to_f
54
+ else
55
+ value
56
+ end
57
+ end
58
+ end
59
+
60
+ def valid?(value)
61
+ !value || allowable_values.include?(value)
62
+ end
63
+ end
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'id' => :'id',
69
+ :'status' => :'status',
70
+ :'channel' => :'channel',
71
+ :'to' => :'to',
72
+ :'expires_at' => :'expiresAt',
73
+ :'attempts' => :'attempts',
74
+ :'max_attempts' => :'maxAttempts',
75
+ :'send_count' => :'sendCount',
76
+ :'last_sent_at' => :'lastSentAt',
77
+ :'created_at' => :'createdAt',
78
+ :'resend' => :'resend'
79
+ }
80
+ end
81
+
82
+ # Returns attribute mapping this model knows about
83
+ def self.acceptable_attribute_map
84
+ attribute_map
85
+ end
86
+
87
+ # Returns all the JSON keys this model knows about
88
+ def self.acceptable_attributes
89
+ acceptable_attribute_map.values
90
+ end
91
+
92
+ # Attribute type mapping.
93
+ def self.openapi_types
94
+ {
95
+ :'id' => :'String',
96
+ :'status' => :'String',
97
+ :'channel' => :'String',
98
+ :'to' => :'String',
99
+ :'expires_at' => :'Time',
100
+ :'attempts' => :'Integer',
101
+ :'max_attempts' => :'Integer',
102
+ :'send_count' => :'Integer',
103
+ :'last_sent_at' => :'Time',
104
+ :'created_at' => :'Time',
105
+ :'resend' => :'Boolean'
106
+ }
107
+ end
108
+
109
+ # List of attributes with nullable: true
110
+ def self.openapi_nullable
111
+ Set.new([
112
+ :'last_sent_at',
113
+ ])
114
+ end
115
+
116
+ # Initializes the object
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ def initialize(attributes = {})
119
+ if (!attributes.is_a?(Hash))
120
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::Verification` initialize method"
121
+ end
122
+
123
+ # check to see if the attribute exists and convert string to symbol for hash key
124
+ acceptable_attribute_map = self.class.acceptable_attribute_map
125
+ attributes = attributes.each_with_object({}) { |(k, v), h|
126
+ if (!acceptable_attribute_map.key?(k.to_sym))
127
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::Verification`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
128
+ end
129
+ h[k.to_sym] = v
130
+ }
131
+
132
+ if attributes.key?(:'id')
133
+ self.id = attributes[:'id']
134
+ end
135
+
136
+ if attributes.key?(:'status')
137
+ self.status = attributes[:'status']
138
+ end
139
+
140
+ if attributes.key?(:'channel')
141
+ self.channel = attributes[:'channel']
142
+ end
143
+
144
+ if attributes.key?(:'to')
145
+ self.to = attributes[:'to']
146
+ end
147
+
148
+ if attributes.key?(:'expires_at')
149
+ self.expires_at = attributes[:'expires_at']
150
+ end
151
+
152
+ if attributes.key?(:'attempts')
153
+ self.attempts = attributes[:'attempts']
154
+ end
155
+
156
+ if attributes.key?(:'max_attempts')
157
+ self.max_attempts = attributes[:'max_attempts']
158
+ end
159
+
160
+ if attributes.key?(:'send_count')
161
+ self.send_count = attributes[:'send_count']
162
+ end
163
+
164
+ if attributes.key?(:'last_sent_at')
165
+ self.last_sent_at = attributes[:'last_sent_at']
166
+ end
167
+
168
+ if attributes.key?(:'created_at')
169
+ self.created_at = attributes[:'created_at']
170
+ end
171
+
172
+ if attributes.key?(:'resend')
173
+ self.resend = attributes[:'resend']
174
+ end
175
+ end
176
+
177
+ # Show invalid properties with the reasons. Usually used together with valid?
178
+ # @return Array for valid properties with the reasons
179
+ def list_invalid_properties
180
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
181
+ invalid_properties = Array.new
182
+ invalid_properties
183
+ end
184
+
185
+ # Check to see if the all the properties in the model are valid
186
+ # @return true if the model is valid
187
+ def valid?
188
+ warn '[DEPRECATED] the `valid?` method is obsolete'
189
+ status_validator = EnumAttributeValidator.new('String', ["pending", "approved", "expired", "max_attempts_reached", "canceled", "delivery_failed"])
190
+ return false unless status_validator.valid?(@status)
191
+ channel_validator = EnumAttributeValidator.new('String', ["sms"])
192
+ return false unless channel_validator.valid?(@channel)
193
+ true
194
+ end
195
+
196
+ # Custom attribute writer method checking allowed values (enum).
197
+ # @param [Object] status Object to be assigned
198
+ def status=(status)
199
+ validator = EnumAttributeValidator.new('String', ["pending", "approved", "expired", "max_attempts_reached", "canceled", "delivery_failed"])
200
+ unless validator.valid?(status)
201
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
202
+ end
203
+ @status = status
204
+ end
205
+
206
+ # Custom attribute writer method checking allowed values (enum).
207
+ # @param [Object] channel Object to be assigned
208
+ def channel=(channel)
209
+ validator = EnumAttributeValidator.new('String', ["sms"])
210
+ unless validator.valid?(channel)
211
+ fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}."
212
+ end
213
+ @channel = channel
214
+ end
215
+
216
+ # Checks equality by comparing each attribute.
217
+ # @param [Object] Object to be compared
218
+ def ==(o)
219
+ return true if self.equal?(o)
220
+ self.class == o.class &&
221
+ id == o.id &&
222
+ status == o.status &&
223
+ channel == o.channel &&
224
+ to == o.to &&
225
+ expires_at == o.expires_at &&
226
+ attempts == o.attempts &&
227
+ max_attempts == o.max_attempts &&
228
+ send_count == o.send_count &&
229
+ last_sent_at == o.last_sent_at &&
230
+ created_at == o.created_at &&
231
+ resend == o.resend
232
+ end
233
+
234
+ # @see the `==` method
235
+ # @param [Object] Object to be compared
236
+ def eql?(o)
237
+ self == o
238
+ end
239
+
240
+ # Calculates hash code according to all attributes.
241
+ # @return [Integer] Hash code
242
+ def hash
243
+ [id, status, channel, to, expires_at, attempts, max_attempts, send_count, last_sent_at, created_at, resend].hash
244
+ end
245
+
246
+ # Builds the object from hash
247
+ # @param [Hash] attributes Model attributes in the form of hash
248
+ # @return [Object] Returns the model itself
249
+ def self.build_from_hash(attributes)
250
+ return nil unless attributes.is_a?(Hash)
251
+ attributes = attributes.transform_keys(&:to_sym)
252
+ transformed_hash = {}
253
+ openapi_types.each_pair do |key, type|
254
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
255
+ transformed_hash["#{key}"] = nil
256
+ elsif type =~ /\AArray<(.*)>/i
257
+ # check to ensure the input is an array given that the attribute
258
+ # is documented as an array but the input is not
259
+ if attributes[attribute_map[key]].is_a?(Array)
260
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
261
+ end
262
+ elsif !attributes[attribute_map[key]].nil?
263
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
264
+ end
265
+ end
266
+ new(transformed_hash)
267
+ end
268
+
269
+ # Returns the object in the form of hash
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_hash
272
+ hash = {}
273
+ self.class.attribute_map.each_pair do |attr, param|
274
+ value = self.send(attr)
275
+ if value.nil?
276
+ is_nullable = self.class.openapi_nullable.include?(attr)
277
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
278
+ end
279
+
280
+ hash[param] = _to_hash(value)
281
+ end
282
+ hash
283
+ end
284
+
285
+ end
286
+
287
+ end
@@ -11,5 +11,5 @@ Generator version: 7.19.0
11
11
  =end
12
12
 
13
13
  module Zernio
14
- VERSION = '0.0.537'
14
+ VERSION = '0.0.539'
15
15
  end
data/lib/zernio-sdk.rb CHANGED
@@ -125,6 +125,8 @@ require 'zernio-sdk/models/check_phone_number_availability200_response'
125
125
  require 'zernio-sdk/models/check_phone_number_portability200_response'
126
126
  require 'zernio-sdk/models/check_phone_number_portability200_response_results_inner'
127
127
  require 'zernio-sdk/models/check_phone_number_portability_request'
128
+ require 'zernio-sdk/models/check_verification200_response'
129
+ require 'zernio-sdk/models/check_verification_request'
128
130
  require 'zernio-sdk/models/complete_google_business_verification_request'
129
131
  require 'zernio-sdk/models/complete_telegram_connect200_response'
130
132
  require 'zernio-sdk/models/complete_whats_app_phone_selection200_response'
@@ -273,6 +275,7 @@ require 'zernio-sdk/models/create_test_lead_request'
273
275
  require 'zernio-sdk/models/create_test_lead_request_field_data_inner'
274
276
  require 'zernio-sdk/models/create_tracking_tag201_response'
275
277
  require 'zernio-sdk/models/create_tracking_tag_request'
278
+ require 'zernio-sdk/models/create_verification_request'
276
279
  require 'zernio-sdk/models/create_voice_call200_response'
277
280
  require 'zernio-sdk/models/create_voice_call_request'
278
281
  require 'zernio-sdk/models/create_voice_web_session200_response'
@@ -929,6 +932,10 @@ require 'zernio-sdk/models/money'
929
932
  require 'zernio-sdk/models/money_amount'
930
933
  require 'zernio-sdk/models/move_account_to_profile200_response'
931
934
  require 'zernio-sdk/models/move_account_to_profile_request'
935
+ require 'zernio-sdk/models/on_verification_approved_request'
936
+ require 'zernio-sdk/models/on_verification_approved_request_verification'
937
+ require 'zernio-sdk/models/on_verification_failed_request'
938
+ require 'zernio-sdk/models/on_verification_failed_request_verification'
932
939
  require 'zernio-sdk/models/on_whats_app_automatic_event_request'
933
940
  require 'zernio-sdk/models/on_whats_app_automatic_event_request_custom_data'
934
941
  require 'zernio-sdk/models/on_whats_app_number_action_required_request'
@@ -1380,6 +1387,7 @@ require 'zernio-sdk/models/validate_subreddit200_response'
1380
1387
  require 'zernio-sdk/models/validate_subreddit200_response_one_of'
1381
1388
  require 'zernio-sdk/models/validate_subreddit200_response_one_of1'
1382
1389
  require 'zernio-sdk/models/validate_subreddit200_response_one_of_subreddit'
1390
+ require 'zernio-sdk/models/verification'
1383
1391
  require 'zernio-sdk/models/verify_sms_registration_otp200_response'
1384
1392
  require 'zernio-sdk/models/verify_sms_registration_otp_request'
1385
1393
  require 'zernio-sdk/models/vote_reddit_thing_request'
@@ -1531,6 +1539,7 @@ require 'zernio-sdk/api/twitter_engagement_api'
1531
1539
  require 'zernio-sdk/api/usage_api'
1532
1540
  require 'zernio-sdk/api/users_api'
1533
1541
  require 'zernio-sdk/api/validate_api'
1542
+ require 'zernio-sdk/api/verify_api'
1534
1543
  require 'zernio-sdk/api/voice_api'
1535
1544
  require 'zernio-sdk/api/webhooks_api'
1536
1545
  require 'zernio-sdk/api/whats_app_api'
data/openapi.yaml CHANGED
@@ -177,6 +177,8 @@ x-documentation:
177
177
  - `whatsapp.number.suspended` - An active number was suspended (e.g. failed payment); carries a `reason`
178
178
  - `whatsapp.number.reactivated` - A suspended number is usable again
179
179
  - `whatsapp.number.released` - A number was released and is no longer usable (terminal); carries a `reason`
180
+ - `verification.approved` - A managed-OTP verification was approved (the user submitted the correct code)
181
+ - `verification.failed` - A managed-OTP verification was exhausted after too many wrong code attempts
180
182
  - `webhook.test` - Test event sent when verifying a webhook endpoint
181
183
 
182
184
  Webhook payloads are signed with HMAC-SHA256 via the `X-Zernio-Signature` header.
@@ -363,7 +365,7 @@ tags:
363
365
  - name: Webhooks
364
366
  description: |
365
367
  Configure webhooks for real-time notifications. Webhooks can be created from the dashboard (Settings → Webhooks) or via this API.
366
- Events: post.scheduled, post.published, post.failed, post.partial, post.cancelled, post.recycled, post.platform.published, post.platform.failed, post.tiktok.url_resolved, post.external.created, post.external.updated, post.external.deleted, account.connected, account.disconnected, account.ads.initial_sync_completed, message.received, conversation.started, call.received, call.ended, call.failed, call.permission_request, message.sent, message.edited, message.deleted, message.delivered, message.read, message.failed, reaction.received, comment.received, review.new, review.updated, lead.received, ad.status_changed, whatsapp.template.status_updated, whatsapp.automatic_event, whatsapp.number.activated, whatsapp.number.declined, whatsapp.number.action_required, whatsapp.number.verification_required, whatsapp.number.suspended, whatsapp.number.reactivated, whatsapp.number.released, whatsapp.number.kyc_submitted, webhook.test.
368
+ Events: post.scheduled, post.published, post.failed, post.partial, post.cancelled, post.recycled, post.platform.published, post.platform.failed, post.tiktok.url_resolved, post.external.created, post.external.updated, post.external.deleted, account.connected, account.disconnected, account.ads.initial_sync_completed, message.received, conversation.started, call.received, call.ended, call.failed, call.permission_request, message.sent, message.edited, message.deleted, message.delivered, message.read, message.failed, reaction.received, comment.received, review.new, review.updated, lead.received, ad.status_changed, whatsapp.template.status_updated, whatsapp.automatic_event, whatsapp.number.activated, whatsapp.number.declined, whatsapp.number.action_required, whatsapp.number.verification_required, whatsapp.number.suspended, whatsapp.number.reactivated, whatsapp.number.released, whatsapp.number.kyc_submitted, verification.approved, verification.failed, webhook.test.
367
369
  Security: optional HMAC-SHA256 signature in X-Zernio-Signature header. Configure a secret key to enable verification. Custom headers supported.
368
370
  - name: Webhook Events
369
371
  description: |
@@ -398,6 +400,13 @@ tags:
398
400
  inventory, complete country KYC, and release numbers here; turn features on
399
401
  via the per-number sub-resources (`/v1/phone-numbers/{id}/voice`, `/sms`,
400
402
  `/whatsapp/...`). Requires a paid plan.
403
+ - name: Verify
404
+ description: |
405
+ Managed one-time passcodes (OTP) for phone verification. Two calls
406
+ handle the whole lifecycle: create a verification (we generate the
407
+ code, deliver it by SMS from a phone number on your account, and store
408
+ only its hash) and check the code the user typed. Usage-based billing
409
+ only.
401
410
  - name: WhatsApp Phone Numbers
402
411
  description: |
403
412
  Deprecated namespace: phone numbers moved to `/v1/phone-numbers` (a number is
@@ -605,6 +614,21 @@ components:
605
614
  effective_account_limit: 2000
606
615
  current_account_count: 2000
607
616
  schemas:
617
+ Verification:
618
+ type: object
619
+ description: 'A managed OTP verification. The code itself is never returned or stored (hash only).'
620
+ properties:
621
+ id: { type: string }
622
+ status: { type: string, enum: [pending, approved, expired, max_attempts_reached, canceled, delivery_failed] }
623
+ channel: { type: string, enum: [sms] }
624
+ to: { type: string }
625
+ expiresAt: { type: string, format: date-time }
626
+ attempts: { type: integer }
627
+ maxAttempts: { type: integer }
628
+ sendCount: { type: integer, description: 'Accepted deliveries (initial send + resends); each bills one verification fee.' }
629
+ lastSentAt: { type: [string, "null"], format: date-time }
630
+ createdAt: { type: string, format: date-time }
631
+ resend: { type: boolean, description: 'Present on create responses: true when an active verification was resent instead of created.' }
608
632
  RfPrediction:
609
633
  type: object
610
634
  description: A Meta Reach & Frequency prediction. Money values in whole units of the ad account currency.
@@ -1864,7 +1888,7 @@ components:
1864
1888
  type: array
1865
1889
  items:
1866
1890
  type: string
1867
- enum: [post.scheduled, post.published, post.failed, post.partial, post.cancelled, post.recycled, post.platform.published, post.platform.failed, post.tiktok.url_resolved, post.external.created, post.external.updated, post.external.deleted, account.connected, account.disconnected, account.ads.initial_sync_completed, message.received, conversation.started, call.received, call.ended, call.failed, call.permission_request, message.sent, message.edited, message.deleted, message.delivered, message.read, message.failed, reaction.received, comment.received, review.new, review.updated, lead.received, ad.status_changed, whatsapp.template.status_updated, whatsapp.automatic_event, whatsapp.number.activated, whatsapp.number.declined, whatsapp.number.action_required, whatsapp.number.verification_required, whatsapp.number.suspended, whatsapp.number.reactivated, whatsapp.number.released, whatsapp.number.kyc_submitted]
1891
+ enum: [post.scheduled, post.published, post.failed, post.partial, post.cancelled, post.recycled, post.platform.published, post.platform.failed, post.tiktok.url_resolved, post.external.created, post.external.updated, post.external.deleted, account.connected, account.disconnected, account.ads.initial_sync_completed, message.received, conversation.started, call.received, call.ended, call.failed, call.permission_request, message.sent, message.edited, message.deleted, message.delivered, message.read, message.failed, reaction.received, comment.received, review.new, review.updated, lead.received, ad.status_changed, whatsapp.template.status_updated, whatsapp.automatic_event, whatsapp.number.activated, whatsapp.number.declined, whatsapp.number.action_required, whatsapp.number.verification_required, whatsapp.number.suspended, whatsapp.number.reactivated, whatsapp.number.released, whatsapp.number.kyc_submitted, verification.approved, verification.failed]
1868
1892
  description: Events subscribed to
1869
1893
  isActive:
1870
1894
  type: boolean
@@ -7910,7 +7934,7 @@ webhooks:
7910
7934
  type: object
7911
7935
  properties:
7912
7936
  id: { type: string }
7913
- event: { type: string, enum: [whatsapp.number.kyc_submitted] }
7937
+ event: { type: string, enum: [whatsapp.number.kyc_submitted, verification.approved, verification.failed] }
7914
7938
  timestamp: { type: string, format: date-time }
7915
7939
  number:
7916
7940
  type: object
@@ -7922,6 +7946,61 @@ webhooks:
7922
7946
  responses:
7923
7947
  '200':
7924
7948
  description: Webhook received successfully
7949
+ verification.approved:
7950
+ post:
7951
+ operationId: onVerificationApproved
7952
+ summary: Verification approved event
7953
+ description: |
7954
+ Fired when a managed-OTP verification is approved (the user submitted
7955
+ the correct code to POST /v1/verify/verifications/{verificationId}/check).
7956
+ tags: [Webhook Events]
7957
+ requestBody:
7958
+ required: true
7959
+ content:
7960
+ application/json:
7961
+ schema:
7962
+ type: object
7963
+ properties:
7964
+ id: { type: string }
7965
+ event: { type: string, enum: [verification.approved] }
7966
+ timestamp: { type: string, format: date-time }
7967
+ verification:
7968
+ type: object
7969
+ properties:
7970
+ verificationId: { type: string }
7971
+ channel: { type: string, enum: [sms] }
7972
+ to: { type: string }
7973
+ responses:
7974
+ '200':
7975
+ description: Webhook received successfully
7976
+ verification.failed:
7977
+ post:
7978
+ operationId: onVerificationFailed
7979
+ summary: Verification failed event
7980
+ description: |
7981
+ Fired when a managed-OTP verification is exhausted (the maximum number
7982
+ of wrong code attempts was reached).
7983
+ tags: [Webhook Events]
7984
+ requestBody:
7985
+ required: true
7986
+ content:
7987
+ application/json:
7988
+ schema:
7989
+ type: object
7990
+ properties:
7991
+ id: { type: string }
7992
+ event: { type: string, enum: [verification.failed] }
7993
+ timestamp: { type: string, format: date-time }
7994
+ verification:
7995
+ type: object
7996
+ properties:
7997
+ verificationId: { type: string }
7998
+ channel: { type: string, enum: [sms] }
7999
+ to: { type: string }
8000
+ reason: { type: string, enum: [max_attempts_reached] }
8001
+ responses:
8002
+ '200':
8003
+ description: Webhook received successfully
7925
8004
  webhook.test:
7926
8005
  post:
7927
8006
  operationId: onWebhookTest
@@ -20818,7 +20897,7 @@ paths:
20818
20897
  minItems: 1
20819
20898
  items:
20820
20899
  type: string
20821
- enum: [post.scheduled, post.published, post.failed, post.partial, post.cancelled, post.recycled, post.platform.published, post.platform.failed, post.tiktok.url_resolved, post.external.created, post.external.updated, post.external.deleted, account.connected, account.disconnected, account.ads.initial_sync_completed, message.received, conversation.started, call.received, call.ended, call.failed, call.permission_request, message.sent, message.edited, message.deleted, message.delivered, message.read, message.failed, reaction.received, comment.received, review.new, review.updated, lead.received, ad.status_changed, whatsapp.template.status_updated, whatsapp.automatic_event, whatsapp.number.activated, whatsapp.number.declined, whatsapp.number.action_required, whatsapp.number.verification_required, whatsapp.number.suspended, whatsapp.number.reactivated, whatsapp.number.released, whatsapp.number.kyc_submitted]
20900
+ enum: [post.scheduled, post.published, post.failed, post.partial, post.cancelled, post.recycled, post.platform.published, post.platform.failed, post.tiktok.url_resolved, post.external.created, post.external.updated, post.external.deleted, account.connected, account.disconnected, account.ads.initial_sync_completed, message.received, conversation.started, call.received, call.ended, call.failed, call.permission_request, message.sent, message.edited, message.deleted, message.delivered, message.read, message.failed, reaction.received, comment.received, review.new, review.updated, lead.received, ad.status_changed, whatsapp.template.status_updated, whatsapp.automatic_event, whatsapp.number.activated, whatsapp.number.declined, whatsapp.number.action_required, whatsapp.number.verification_required, whatsapp.number.suspended, whatsapp.number.reactivated, whatsapp.number.released, whatsapp.number.kyc_submitted, verification.approved, verification.failed]
20822
20901
  description: Events to subscribe to (at least one required)
20823
20902
  isActive:
20824
20903
  type: boolean
@@ -20892,7 +20971,7 @@ paths:
20892
20971
  minItems: 1
20893
20972
  items:
20894
20973
  type: string
20895
- enum: [post.scheduled, post.published, post.failed, post.partial, post.cancelled, post.recycled, post.platform.published, post.platform.failed, post.tiktok.url_resolved, post.external.created, post.external.updated, post.external.deleted, account.connected, account.disconnected, account.ads.initial_sync_completed, message.received, conversation.started, call.received, call.ended, call.failed, call.permission_request, message.sent, message.edited, message.deleted, message.delivered, message.read, message.failed, reaction.received, comment.received, review.new, review.updated, lead.received, ad.status_changed, whatsapp.template.status_updated, whatsapp.automatic_event, whatsapp.number.activated, whatsapp.number.declined, whatsapp.number.action_required, whatsapp.number.verification_required, whatsapp.number.suspended, whatsapp.number.reactivated, whatsapp.number.released, whatsapp.number.kyc_submitted]
20974
+ enum: [post.scheduled, post.published, post.failed, post.partial, post.cancelled, post.recycled, post.platform.published, post.platform.failed, post.tiktok.url_resolved, post.external.created, post.external.updated, post.external.deleted, account.connected, account.disconnected, account.ads.initial_sync_completed, message.received, conversation.started, call.received, call.ended, call.failed, call.permission_request, message.sent, message.edited, message.deleted, message.delivered, message.read, message.failed, reaction.received, comment.received, review.new, review.updated, lead.received, ad.status_changed, whatsapp.template.status_updated, whatsapp.automatic_event, whatsapp.number.activated, whatsapp.number.declined, whatsapp.number.action_required, whatsapp.number.verification_required, whatsapp.number.suspended, whatsapp.number.reactivated, whatsapp.number.released, whatsapp.number.kyc_submitted, verification.approved, verification.failed]
20896
20975
  description: Events to subscribe to. Must contain at least one event if provided.
20897
20976
  isActive:
20898
20977
  type: boolean
@@ -38810,3 +38889,124 @@ paths:
38810
38889
  '403': { description: 'Ads access required (Ads add-on on legacy plans, included on usage-based plans), or the Meta token lacks ads permissions (reconnect required).' }
38811
38890
  '404': { description: Account or tracking tag not found. }
38812
38891
  '405': { description: Platform does not support tracking-tag stats. }
38892
+
38893
+ /v1/verify/verifications:
38894
+ post:
38895
+ operationId: createVerification
38896
+ tags: [Verify]
38897
+ summary: Send a verification code
38898
+ description: |
38899
+ Generate a one-time code, deliver it to the recipient, and store only
38900
+ its hash. Check the user-typed code with
38901
+ POST /v1/verify/verifications/{verificationId}/check.
38902
+
38903
+ Re-POSTing for the same (channel, to) while a verification is active
38904
+ RESENDS a fresh code on the existing verification (200 with
38905
+ `resend: true`) instead of creating a new one; resends are limited to
38906
+ one per 60 seconds (429 with `retryAfterSeconds` inside the cooldown).
38907
+ The stored brandName/codeLength/ttlMinutes win on a resend.
38908
+
38909
+ Codes deliver by SMS from a phone number on your account (`from`
38910
+ optional when you own exactly one SMS-enabled number) and the message
38911
+ uses a fixed template. Each accepted send bills one verification fee
38912
+ plus the standard message rate.
38913
+ security:
38914
+ - bearerAuth: []
38915
+ requestBody:
38916
+ required: true
38917
+ content:
38918
+ application/json:
38919
+ schema:
38920
+ type: object
38921
+ required: [channel, to]
38922
+ properties:
38923
+ channel: { type: string, enum: [sms], description: 'SMS-only for now.' }
38924
+ to: { type: string, description: "E.164 phone number." }
38925
+ from: { type: string, description: "The SMS-enabled number on your account to send from. Defaults to your only SMS number." }
38926
+ brandName: { type: string, maxLength: 30, description: "Your app or business name, rendered in the message. Defaults to your account name. Letters, numbers, and basic punctuation only." }
38927
+ codeLength: { type: integer, minimum: 4, maximum: 8, default: 6 }
38928
+ ttlMinutes: { type: integer, minimum: 1, maximum: 15, default: 10 }
38929
+ responses:
38930
+ '201':
38931
+ description: Verification created and the code sent.
38932
+ content:
38933
+ application/json:
38934
+ schema:
38935
+ $ref: '#/components/schemas/Verification'
38936
+ '200':
38937
+ description: 'Active verification found: a fresh code was resent (`resend: true`).'
38938
+ content:
38939
+ application/json:
38940
+ schema:
38941
+ $ref: '#/components/schemas/Verification'
38942
+ '400': { $ref: '#/components/responses/BadRequest' }
38943
+ '401': { $ref: '#/components/responses/Unauthorized' }
38944
+ '403': { description: Verifications require usage-based billing. }
38945
+ '404': { description: "The 'from' number is not an SMS-enabled number on this account." }
38946
+ '409': { description: The recipient has opted out of messages from your number. }
38947
+ '422': { description: "Verifications need an SMS-enabled number on your account; add one first." }
38948
+ '429': { description: 'Resend cooldown or a send cap was hit; `retryAfterSeconds` says when to retry.' }
38949
+
38950
+ /v1/verify/verifications/{verificationId}:
38951
+ get:
38952
+ operationId: getVerification
38953
+ tags: [Verify]
38954
+ summary: Get a verification
38955
+ description: |
38956
+ Current state of a verification. `status` is effective (a pending code
38957
+ past its expiry reads as `expired`). Verification records are deleted
38958
+ 24 hours after creation, after which this returns 404.
38959
+ security:
38960
+ - bearerAuth: []
38961
+ parameters:
38962
+ - { name: verificationId, in: path, required: true, schema: { type: string } }
38963
+ responses:
38964
+ '200':
38965
+ description: The verification.
38966
+ content:
38967
+ application/json:
38968
+ schema:
38969
+ $ref: '#/components/schemas/Verification'
38970
+ '400': { $ref: '#/components/responses/BadRequest' }
38971
+ '401': { $ref: '#/components/responses/Unauthorized' }
38972
+ '404': { description: Verification not found (or already reaped). }
38973
+
38974
+ /v1/verify/verifications/{verificationId}/check:
38975
+ post:
38976
+ operationId: checkVerification
38977
+ tags: [Verify]
38978
+ summary: Check a verification code
38979
+ description: |
38980
+ Verify the code the user typed. Wrong, expired, and exhausted codes
38981
+ answer 200 with `valid: false` and the settled `status` — only an
38982
+ unknown id is a 404. A correct code consumes the verification
38983
+ (single-use, `status: approved`) and fires the `verification.approved`
38984
+ webhook; the 5th wrong attempt settles it as `max_attempts_reached`
38985
+ and fires `verification.failed`.
38986
+ security:
38987
+ - bearerAuth: []
38988
+ parameters:
38989
+ - { name: verificationId, in: path, required: true, schema: { type: string } }
38990
+ requestBody:
38991
+ required: true
38992
+ content:
38993
+ application/json:
38994
+ schema:
38995
+ type: object
38996
+ required: [code]
38997
+ properties:
38998
+ code: { type: string, pattern: '^\d{4,8}$' }
38999
+ responses:
39000
+ '200':
39001
+ description: 'Check result: the verification plus `valid`.'
39002
+ content:
39003
+ application/json:
39004
+ schema:
39005
+ allOf:
39006
+ - $ref: '#/components/schemas/Verification'
39007
+ - type: object
39008
+ properties:
39009
+ valid: { type: boolean }
39010
+ '400': { $ref: '#/components/responses/BadRequest' }
39011
+ '401': { $ref: '#/components/responses/Unauthorized' }
39012
+ '404': { description: Verification not found (or already reaped). }