POST https://api.authy.com/protected/json/phones/verification/start
When... | Example... | Error code | Response is... |
---|---|---|---|
all is well | { "country_code": "84", "phone_number": "0866742932", "via" : "sms" } |
{ "carrier": "Viettel Mobile", "is_cellphone": true, "message": "Text message sent to +84 86-674-2932.", "seconds_to_expire": 599, "uuid": "b07107c0-47be-0137-910b-0a4259707972", "success": true } |
|
parameter missing | { "phone_number": "0866742932", "via" : "sms" } |
60004 | { "error_code": "60004", "message": "Invalid parameter: country_code - Parameter is required", "errors": { "message": "Invalid parameter: country_code - Parameter is required" }, "success": false } |
bogus phone number (phone number too short) |
{ "country_code": "1", "phone_number": "12345678", "via" : "sms" } |
60033 | { "error_code": "60033", "message": "Phone number is invalid", "errors": { "message": "Phone number is invalid" }, "success": false } |
bogus phone number (country code bogus) |
{ "country_code": "222", "phone_number": "0866742932", "via" : "sms" } |
60033 | { "error_code": "60033", "message": "Phone number is invalid", "errors": { "message": "Phone number is invalid" }, "success": false } |
bogus phone number (country code is not number) |
{ "country_code": "zzz", "phone_number": "0866742932", "via" : "sms" } |
60004 | { "error_code": "60004", "message": "Invalid parameter: country_code - 'xxx' is not a valid Integer", "errors": { "message": "Invalid parameter: country_code - 'xxx' is not a valid Integer" }, "success": false } |
toll free number | { "country_code": "1", "phone_number": "8557747810", "via" : "sms" } |
60083 | { "error_code": "60083", "message": "Phone number not provisioned with any carrier", "errors": { "message": "Phone number not provisioned with any carrier" }, "success": false } |
Skype/Land Line | { "country_code": "1", "phone_number": "4252960753", "via" : "sms" } |
60082 | { "error_code": "60082", "message": "Cannot send SMS to landline phone numbers", "errors": { "message": "Cannot send SMS to landline phone numbers" }, "success": false } |
wrong API Key / no API Key |
... | 60001 | { "error_code": "60001", "message": "Invalid API key", "errors": { "message": "Invalid API key" }, "success": false } |
NOTE:
- extra (unknown) parameters are ignored
- sending "all is well" example multiple times return the same response without sending new SMS, the only difference - seconds_to_expire
GET https://api.authy.com/protected/json/phones/verification/check
When... | Example... | Error code | Response is... |
---|---|---|---|
all is well | { "country_code": "84", "phone_number": "0866742932", "verification_code" : "3733" } |
{ "message": "Verification code is correct.", "success": true } |
|
all is well again | 60023 | { "message": "No pending verifications for +84 86-674-2932 found.", "success": false, "errors": { "message": "No pending verifications for +84 86-674-2932 found." }, "error_code": "60023" } |
|
all is well after timeout | 60023 | { "message": "No pending verifications for +84 86-674-2932 found.", "success": false, "errors": { "message": "No pending verifications for +84 86-674-2932 found." }, "error_code": "60023" } |
|
incorrect code | { "country_code": "84", "phone_number": "0866742932", "verification_code" : "1234" } |
60022 | { "error_code": "60022", "message": "Verification code is incorrect", "errors": { "message": "Verification code is incorrect" }, "success": false } |
correct code after trying incorrect code | { "country_code": "84", "phone_number": "0866742932", "verification_code" : "9171" } |
{ "message": "Verification code is correct.", "success": true } |
|
phone number without "start" | 60023 | { "message": "No pending verifications for +84 86-674-2932 found.", "success": false, "errors": { "message": "No pending verifications for +84 86-674-2932 found." }, "error_code": "60023" } |
This is a life saver. Thanks so much for sharing @leapingbytes