nexmo_api_specification 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,737 @@
1
+ openapi: 3.0.0
2
+ servers:
3
+ - url: 'https://api.nexmo.com/verify'
4
+ info:
5
+ title: Nexmo Verify API
6
+ version: 1.0.0
7
+ description: >-
8
+ Nexmo's Verify API allows you to send a PIN by SMS and phone to prove a user
9
+ can be contacted at a specific phone number.
10
+
11
+
12
+ This is useful for:
13
+
14
+
15
+ * Spam protection - prevent spammers from mass-creating new accounts (etc.)
16
+
17
+ * Hack protection - if you detect suspicious or significant activities,
18
+ validate that the person using a phone number owns it
19
+
20
+ * Two-factor authentication
21
+
22
+ * Reaching users - ensuring you have the correct phone number makes it easy
23
+ to contact users when you need to
24
+
25
+
26
+ By default, the PIN is first sent via text message (SMS). If there is no
27
+ reply the Verify API will then try a voice call using text-to-speech (TTS).
28
+
29
+
30
+ TTS messages are read in the locale that matches the phone number. (For
31
+ example, the TTS for a 61* phone number is sent using an Australian accent
32
+ for the English language (en-au). You can explicitly control the language,
33
+ accent and gender in TTS from the Verify Request.)
34
+ contact:
35
+ name: Nexmo.com
36
+ email: devrel@nexmo.com
37
+ url: 'https://developer.nexmo.com/'
38
+ x-twitter: Nexmo
39
+ termsOfService: 'https://www.nexmo.com/terms-of-use'
40
+ license:
41
+ name: The MIT License (MIT)
42
+ url: 'https://opensource.org/licenses/MIT'
43
+ x-logo:
44
+ url: 'https://twitter.com/Nexmo/profile_image?size=original'
45
+ x-apiClientRegistration: 'https://dashboard.nexmo.com/sign-up'
46
+ externalDocs:
47
+ url: 'https://developer.nexmo.com/api/verify'
48
+ x-sha1: 481de32ea146584aabec4b76f62a86661f383078
49
+ security:
50
+ - apiKey: []
51
+ apiSecret: []
52
+ tags:
53
+ - name: Verify Request
54
+ description: >-
55
+ Generate and send a PIN to your user. You use the `request_id` in the
56
+ response for the Verify Check.
57
+ - name: Verify Check
58
+ description: >-
59
+ Confirm that the PIN you received from your user matches the one sent by
60
+ Nexmo as a result of your Verify Request.
61
+ - name: Verify Search
62
+ description: Lookup the status of one or more requests.
63
+ - name: Verify Control
64
+ description: Control the progress of your Verify Requests.
65
+ paths:
66
+ '/{format}':
67
+ get:
68
+ description: >-
69
+ To use Verify Request you:
70
+
71
+ * Create a Request to send a PIN to your user.
72
+
73
+ * Check the response codes in the Response to ensure that your request
74
+ was successful.
75
+ operationId: verifyRequest
76
+ tags:
77
+ - Verify Request
78
+ parameters:
79
+ - $ref: '#/components/parameters/format'
80
+ - name: number
81
+ required: true
82
+ in: query
83
+ description: >-
84
+ The mobile or landline phone number to verify. Unless you are
85
+ setting `country` explicitly, this number must be in
86
+ [E.164](https://en.wikipedia.org/wiki/E.164) format.
87
+ schema:
88
+ type: string
89
+ example: '447700900000'
90
+ - name: country
91
+ required: false
92
+ in: query
93
+ description: >-
94
+ If you do not set `number` in international format or you are not
95
+ sure if `number` is correctly formatted, set `country` with the
96
+ two-character country code. Verify works out the international phone
97
+ number for you.
98
+ schema:
99
+ type: string
100
+ example: GB
101
+ - name: brand
102
+ required: true
103
+ in: query
104
+ description: >-
105
+ The name of the company or App you are using Verify for. This 18
106
+ character alphanumeric string is used in the body of Verify message.
107
+ For example: "Your _brand_ PIN is ...".
108
+ schema:
109
+ type: string
110
+ maxLength: 18
111
+ example: Acme Inc
112
+ - name: sender_id
113
+ required: false
114
+ in: query
115
+ description: >-
116
+ An 11 character alphanumeric string to specify the SenderID for SMS
117
+ sent by Verify. Depending on the destination of the phone number you
118
+ are applying, restrictions may apply.
119
+ schema:
120
+ type: string
121
+ maxLength: 11
122
+ default: VERIFY
123
+ example: VERIFY
124
+ - name: code_length
125
+ required: false
126
+ in: query
127
+ description: The length of the PIN.
128
+ schema:
129
+ type: integer
130
+ enum:
131
+ - 4
132
+ - 6
133
+ default: 4
134
+ example: 4
135
+ - name: lg
136
+ required: false
137
+ in: query
138
+ description: >-
139
+ By default, the SMS or text-to-speech (TTS) message is generated in
140
+ the locale that matches the `number`. For example, the text message
141
+ or TTS message for a 33* number is sent in French. Use this
142
+ parameter to explicitly control the language, accent and gender used
143
+ for the Verify request.
144
+ example: en-us
145
+ schema:
146
+ type: string
147
+ default: en-us
148
+ enum:
149
+ - de-de
150
+ - en-au
151
+ - en-gb
152
+ - en-us
153
+ - en-in
154
+ - es-es
155
+ - es-mx
156
+ - es-us
157
+ - fr-ca
158
+ - fr-fr
159
+ - is-is
160
+ - it-it
161
+ - ja-jp
162
+ - ko-kr
163
+ - nl-nl
164
+ - pl-pl
165
+ - pt-pt
166
+ - pt-br
167
+ - ro-ro
168
+ - ru-ru
169
+ - sv-se
170
+ - tr-tr
171
+ - zh-cn
172
+ - zh-tw
173
+ x-ms-enum:
174
+ values:
175
+ - value: de-de
176
+ description: 'German, German (female / male)'
177
+ - value: en-au
178
+ description: 'English, Australian (female / male)'
179
+ - value: en-gb
180
+ description: 'English, UK (female / male)'
181
+ - value: en-us
182
+ description: 'English, US (female / male)'
183
+ - value: en-in
184
+ description: 'English, Indian (female)'
185
+ - value: es-es
186
+ description: 'Spanish, Spanish (female / male)'
187
+ - value: es-mx
188
+ description: 'Spanish, Mexican (female)'
189
+ - value: es-us
190
+ description: 'Spanish, US (female / male)'
191
+ - value: fr-ca
192
+ description: 'French, Canadian (female)'
193
+ - value: fr-fr
194
+ description: 'French, French (female / male)'
195
+ - value: is-is
196
+ description: 'Icelandic, Icelandic (female / male)'
197
+ - value: it-it
198
+ description: 'Italian, Italian (female / male)'
199
+ - value: ja-jp
200
+ description: 'Japanese, Japanese (female / male)'
201
+ - value: ko-kr
202
+ description: 'Korean, Korean (female / male)'
203
+ - value: nl-nl
204
+ description: 'Dutch, Netherlands (female / male)'
205
+ - value: pl-pl
206
+ description: 'Polish, Polish (female / male)'
207
+ - value: pt-pt
208
+ description: 'Portuguese, Portuguese (male)'
209
+ - value: pt-br
210
+ description: 'Portuguese, Brazilian (female / male)'
211
+ - value: ro-ro
212
+ description: 'Romanian, Romanian (female)'
213
+ - value: ru-ru
214
+ description: 'Russian, Russian (female)'
215
+ - value: sv-se
216
+ description: 'Swedish, Sweden (female)'
217
+ - value: tr-tr
218
+ description: 'Turkish, Turkish (female)'
219
+ - value: zh-cn
220
+ description: 'Chinese (Mandarin), Simplified Chinese (female / male)'
221
+ - value: zh-tw
222
+ description: >-
223
+ Chinese, Traditional. Text only. If you request Taiwanese
224
+ (`zh-tw`), the text message will be sent in Traditional
225
+ Chinese, but the voice call uses a female voice speaking
226
+ English with a Chinese accent.
227
+ - name: require_type
228
+ required: false
229
+ in: query
230
+ description: >-
231
+ Restrict verification to a certain network type.
232
+
233
+ **Note**: contact [support@nexmo.com](mailto:support@nexmo.com) to
234
+ enable this feature.
235
+ schema:
236
+ type: string
237
+ enum:
238
+ - All
239
+ - Mobile
240
+ - Landline
241
+ example: All
242
+ - name: pin_expiry
243
+ required: false
244
+ in: query
245
+ description: >-
246
+ The PIN validity time from generation, in seconds. When specified
247
+ together, pin_expiry must be an integer multiple of
248
+ `next_event_wait`. Otherwise, pin_expiry is set to equal
249
+ next_event_wait. For example:
250
+
251
+
252
+ * `pin_expiry` = 360 seconds, so `next_event_wait` = 120 seconds -
253
+ all three attempts have the same PIN.
254
+
255
+ * `pin_expiry` = 240 seconds, so `next_event_wait` = 120 seconds -
256
+ 1st and 2nd attempts have the same PIN, third attempt has a
257
+ different PIN.
258
+
259
+ * `pin_expiry` = 120 (or 200 or 400 seconds) - each attempt has a
260
+ different PIN.
261
+ schema:
262
+ type: integer
263
+ minimum: 60
264
+ maximum: 3600
265
+ default: 300
266
+ example: 300
267
+ - name: next_event_wait
268
+ required: false
269
+ in: query
270
+ description: >-
271
+ Specifies the wait time in seconds between attempts to deliver the
272
+ PIN. Verify calculates the default value based on the average time
273
+ taken by users to complete verification.
274
+ schema:
275
+ type: integer
276
+ minimum: 60
277
+ maximum: 900
278
+ example: 300
279
+ responses:
280
+ '200':
281
+ description: OK
282
+ content:
283
+ application/json:
284
+ schema:
285
+ $ref: '#/components/schemas/requestResponse'
286
+ text/plain:
287
+ schema:
288
+ $ref: '#/components/schemas/requestResponse'
289
+ '/check/{format}':
290
+ get:
291
+ description: >-
292
+ To use Verify Check you:
293
+
294
+
295
+ * Use a check request to send the PIN you received from your user to
296
+ Nexmo.
297
+
298
+ * Check the response codes in the response to see if the PIN sent by
299
+ your user matched the PIN generated by Nexmo.
300
+ operationId: verifyCheck
301
+ tags:
302
+ - Verify Check
303
+ parameters:
304
+ - $ref: '#/components/parameters/format'
305
+ - name: request_id
306
+ required: true
307
+ in: query
308
+ description: >-
309
+ The identifier of the Verify request to check. This is the
310
+ `request_id` you received in the Verify Request response.
311
+ schema:
312
+ type: string
313
+ maxLength: 32
314
+ example: aaaaaaaa-bbbb-cccc-dddd-0123456789ab
315
+ - name: code
316
+ required: true
317
+ in: query
318
+ description: The PIN given by your user.
319
+ schema:
320
+ type: string
321
+ minLength: 4
322
+ maxLength: 6
323
+ example: '1234'
324
+ - name: ip_address
325
+ required: false
326
+ in: query
327
+ description: >-
328
+ The IP Address used by your user when they entered the PIN. Nexmo
329
+ uses this information to identify fraud and spam patterns across our
330
+ customer base. This ultimately benefits all Nexmo customers.
331
+ schema:
332
+ type: string
333
+ example: 123.0.0.255
334
+ responses:
335
+ '200':
336
+ description: OK
337
+ content:
338
+ application/json:
339
+ schema:
340
+ $ref: '#/components/schemas/checkResponse'
341
+ text/plain:
342
+ schema:
343
+ $ref: '#/components/schemas/checkResponse'
344
+ '/search/{format}':
345
+ get:
346
+ description: >-
347
+ 1. Send a Verify Search request containing the `request_id`s of the
348
+ Verify requests to search for.
349
+
350
+ 2. Check the `status` response parameter in the Search Response to see
351
+ if the request was successfully completed.
352
+ operationId: verifySearch
353
+ tags:
354
+ - Verify Search
355
+ parameters:
356
+ - $ref: '#/components/parameters/format'
357
+ - name: request_id
358
+ required: false
359
+ in: query
360
+ description: The `request_id` you received in the Verify Request Response.
361
+ schema:
362
+ type: string
363
+ example: aaaaaaaa-bbbb-cccc-dddd-0123456789ab
364
+ - name: request_ids
365
+ required: false
366
+ in: query
367
+ description: >-
368
+ More than one `request_id`. Each `request_id` is a new parameter in
369
+ the Verify Search request.
370
+ schema:
371
+ type: array
372
+ items:
373
+ type: string
374
+ example: aaaaaaaa-bbbb-cccc-dddd-0123456789ab
375
+ maxItems: 10
376
+ style: form
377
+ explode: true
378
+ responses:
379
+ '200':
380
+ description: OK
381
+ content:
382
+ application/json:
383
+ schema:
384
+ $ref: '#/components/schemas/searchResponse'
385
+ text/plain:
386
+ schema:
387
+ $ref: '#/components/schemas/searchResponse'
388
+ '/control/{format}':
389
+ get:
390
+ description: |-
391
+ To control the progress of your Verify Requests:
392
+
393
+ 1. Send a Verify request.
394
+ 2. Check the response.
395
+ operationId: verifyControl
396
+ tags:
397
+ - Verify Control
398
+ parameters:
399
+ - $ref: '#/components/parameters/format'
400
+ - name: request_id
401
+ required: true
402
+ in: query
403
+ description: 'The `request_id` you received in the Verify Request Response].'
404
+ schema:
405
+ type: string
406
+ example: aaaaaaaa-bbbb-cccc-dddd-0123456789ab
407
+ - name: cmd
408
+ required: true
409
+ in: query
410
+ description: >-
411
+ Change the command workflow. Verification requests can't be
412
+ cancelled within the first 30 seconds. You must wait at least 30s
413
+ after sending a Verify Request before cancelling.
414
+ schema:
415
+ type: string
416
+ enum:
417
+ - cancel
418
+ - trigger_next_event
419
+ x-ms-enum:
420
+ values:
421
+ - value: cancel
422
+ description: stop the request
423
+ - value: trigger_next_event
424
+ description: advance the request to the next part of the process.
425
+ example: cancel
426
+ responses:
427
+ '200':
428
+ description: OK
429
+ content:
430
+ application/json:
431
+ schema:
432
+ $ref: '#/components/schemas/controlResponse'
433
+ text/plain:
434
+ schema:
435
+ $ref: '#/components/schemas/controlResponse'
436
+ components:
437
+ parameters:
438
+ format:
439
+ name: format
440
+ required: true
441
+ in: path
442
+ description: The response format.
443
+ schema:
444
+ type: string
445
+ enum:
446
+ - json
447
+ - xml
448
+ example: json
449
+ schemas:
450
+ requestResponse:
451
+ type: object
452
+ properties:
453
+ request_id:
454
+ type: string
455
+ description: >-
456
+ The unique ID of the Verify request you sent. You use this
457
+ request_id for the Verify Check.
458
+ maxLength: 32
459
+ example: aaaaaaaa-bbbb-cccc-dddd-0123456789ab
460
+ status:
461
+ type: string
462
+ description: The response code that explains how your request proceeded.
463
+ example: '0'
464
+ enum:
465
+ - '0'
466
+ - '1'
467
+ - '2'
468
+ - '3'
469
+ - '4'
470
+ - '5'
471
+ - '6'
472
+ - '7'
473
+ - '8'
474
+ - '9'
475
+ - '10'
476
+ - '15'
477
+ - '16'
478
+ - '17'
479
+ - '18'
480
+ - '19'
481
+ - '101'
482
+ x-ms-enum:
483
+ values:
484
+ - value: '0'
485
+ description: The request was successfully accepted by Nexmo.
486
+ - value: '1'
487
+ description: >-
488
+ You are trying to send more than the maximum of 30 requests
489
+ per second.
490
+ - value: '2'
491
+ description: The stated parameter is missing.
492
+ - value: '3'
493
+ description: >-
494
+ Invalid value for parameter. If you see Facility not allowed
495
+ in the error text, check that you are using the correct Base
496
+ URL in your request.
497
+ - value: '4'
498
+ description: >-
499
+ The supplied API key or secret in the request is either
500
+ invalid or disabled.
501
+ - value: '5'
502
+ description: >-
503
+ An error occurred processing this request in the Cloud
504
+ Communications Platform.
505
+ - value: '6'
506
+ description: The request could not be routed.
507
+ - value: '7'
508
+ description: >-
509
+ The number you are trying to verify is blacklisted for
510
+ verification
511
+ - value: '8'
512
+ description: >-
513
+ The api_key you supplied is for an account that has been
514
+ barred from submitting messages
515
+ - value: '9'
516
+ description: >-
517
+ Your account does not have sufficient credit to process this
518
+ request.
519
+ - value: '10'
520
+ description: Concurrent verifications to the same number are not allowed
521
+ - value: '15'
522
+ description: The request has been rejected.
523
+ - value: '16'
524
+ description: The code inserted does not match the expected value
525
+ - value: '17'
526
+ description: >-
527
+ You can run Verify Check on a `request_id` up to three times
528
+ unless a new PIN code is generated. If you check a request
529
+ more than 3 times, it is set to FAILED and you cannot check it
530
+ again.
531
+ - value: '18'
532
+ description: >-
533
+ You added more than the maximum of 10 `request_id`s to your
534
+ request.
535
+ - value: '19'
536
+ description: No more events are left to execute for the request
537
+ - value: '101'
538
+ description: There are no matching Verify requests.
539
+ error_text:
540
+ type: string
541
+ description: 'If status is not 0, this explains the error encountered.'
542
+ example: error
543
+ xml:
544
+ name: verify_response
545
+ checkResponse:
546
+ type: object
547
+ properties:
548
+ request_id:
549
+ type: string
550
+ description: >-
551
+ The `request_id` you received in the Verify Request Response and
552
+ used in the Verify Search request.
553
+ example: aaaaaaaa-bbbb-cccc-dddd-0123456789ab
554
+ event_id:
555
+ type: string
556
+ description: The identifier of the SMS `message-id`.
557
+ example: 0A00000012345678
558
+ status:
559
+ type: string
560
+ description: >-
561
+ If the value of status is `0`, your user entered the correct PIN. If
562
+ it is not, check the response code.
563
+ example: '0'
564
+ price:
565
+ type: string
566
+ description: The price charged for this Verify request.
567
+ example: '0.10000000'
568
+ currency:
569
+ type: string
570
+ description: Currency code.
571
+ example: EUR
572
+ error_text:
573
+ type: string
574
+ description: 'If status is not 0, this is brief explanation about the error.'
575
+ example: error
576
+ xml:
577
+ name: verify_response
578
+ searchResponse:
579
+ xml:
580
+ name: verify_request
581
+ type: object
582
+ properties:
583
+ request_id:
584
+ type: string
585
+ description: >-
586
+ The `request_id` you received in the Verify Request Response and
587
+ used in the Verify Search request.
588
+ example: aaaaaaaa-bbbb-cccc-dddd-0123456789ab
589
+ account_id:
590
+ type: string
591
+ description: The Account ID the request was for.
592
+ example: abcdef01
593
+ status:
594
+ type: string
595
+ description: The status of the Verify Request.
596
+ example: IN PROGRESS
597
+ enum:
598
+ - IN PROGRESS
599
+ - SUCCESS
600
+ - FAILED
601
+ - EXPIRED
602
+ - CANCELLED
603
+ - '101'
604
+ x-ms-enum:
605
+ values:
606
+ - value: IN PROGRESS
607
+ description: still in progress.
608
+ - value: SUCCESS
609
+ description: your user entered the PIN correctly.
610
+ - value: FAILED
611
+ description: user entered the wrong pin more than 3 times.
612
+ - value: EXPIRED
613
+ description: no PIN entered during the `pin_expiry` time.
614
+ - value: CANCELLED
615
+ description: the request was cancelled using Verify Control.
616
+ - value: '101'
617
+ description: >-
618
+ the `request_id` you set in the Verify Search request is
619
+ invalid.
620
+ number:
621
+ type: string
622
+ description: The phone number this _Verify Request_ was made for.
623
+ example: '447700900000'
624
+ price:
625
+ type: string
626
+ description: The price charged for this _Verify Request_.
627
+ example: '0.10000000'
628
+ currency:
629
+ type: string
630
+ description: The currency code.
631
+ example: EUR
632
+ sender_id:
633
+ type: string
634
+ description: The sender_id you provided in the _Verify Request_.
635
+ default: verify
636
+ example: mySenderId
637
+ date_submitted:
638
+ type: string
639
+ description: >-
640
+ The date and time the _Verification Request_ was submitted. This
641
+ response parameter is in the following format YYYY-MM-DD HH:MM:SS.
642
+ example: '2020-01-01 12:00:00'
643
+ date_finalized:
644
+ type: string
645
+ description: >-
646
+ The date and time the _Verification Request_ was completed. This
647
+ response parameter is in the following format YYYY-MM-DD HH:MM:SS.
648
+ example: '2020-01-01 12:00:00'
649
+ first_event_date:
650
+ type: string
651
+ description: >-
652
+ Time first attempt was made. This response parameter is in the
653
+ following format YYYY-MM-DD HH:MM:SS.
654
+ example: '2020-01-01 12:00:00'
655
+ last_event_date:
656
+ type: string
657
+ description: >-
658
+ Time last attempt was made. This response parameter is in the
659
+ following format YYYY-MM-DD HH:MM:SS.
660
+ example: '2020-01-01 12:00:00'
661
+ checks:
662
+ type: array
663
+ xml:
664
+ wrapped: true
665
+ description: The list of checks made for this verification and their outcomes.
666
+ items:
667
+ type: object
668
+ xml:
669
+ name: check
670
+ properties:
671
+ date_received:
672
+ type: string
673
+ example: '2020-01-01 12:00:00'
674
+ code:
675
+ type: string
676
+ status:
677
+ type: string
678
+ enum:
679
+ - VALID
680
+ - INVALID
681
+ ip_address:
682
+ type: string
683
+ example: 123.0.0.255
684
+ error_text:
685
+ type: string
686
+ description: 'If `status` is not _SUCCESS_, this message explains the issue.'
687
+ example: user entered the wrong pin more than 3 times
688
+ controlResponse:
689
+ type: object
690
+ xml:
691
+ name: response
692
+ properties:
693
+ status:
694
+ type: string
695
+ description: >-
696
+ The Verify Control Response code that explains how your request
697
+ proceeded.
698
+ example: '0'
699
+ enum:
700
+ - '0'
701
+ - '19'
702
+ x-ms-enum:
703
+ values:
704
+ - value: '0'
705
+ description: Success
706
+ - value: null
707
+ description: >-
708
+ Cancel: You must wait at least 30s after sending a Verify
709
+ Request before cancelling, or Verify has made too many
710
+ attempts to redeliver a PIN for this request; you have to wait
711
+ for the workflow to complete. Also, you cannot initiate a new
712
+ Verify Request until this one expires. Trigger_next_event: All
713
+ the attempts to deliver the PIN for this request have been
714
+ completed and there are no more events to skip to.
715
+ command:
716
+ type: string
717
+ description: The `cmd` you sent in the request.
718
+ example: cancel
719
+ error_text:
720
+ type: string
721
+ description: 'If status is not 0, this explains the error encountered.'
722
+ example: error
723
+ securitySchemes:
724
+ apiKey:
725
+ type: apiKey
726
+ name: api_key
727
+ in: query
728
+ description: >-
729
+ You can find your API key in your [account
730
+ overview](https://dashboard.nexmo.com/account-overview)
731
+ apiSecret:
732
+ type: apiKey
733
+ name: api_secret
734
+ in: query
735
+ description: >-
736
+ You can find your API secret in your [account
737
+ overview](https://dashboard.nexmo.com/account-overview)