{"id":9402,"library":"vonage-verify","title":"Vonage Verify Python Library","description":"The `vonage-verify` package provides Python bindings for the Vonage Verify API, enabling developers to implement two-factor authentication (2FA) via various channels like SMS, Voice, WhatsApp, and Email. It also supports Silent Authentication for a seamless user experience. This library is designed to be used in conjunction with the main `vonage` Python SDK. The current version is 2.1.0, and it follows the release cadence of the broader Vonage Python SDK.","status":"active","version":"2.1.0","language":"en","source_language":"en","source_url":"https://github.com/Vonage/vonage-python-sdk","tags":["Vonage","Verify API","2FA","Two-Factor Authentication","SMS","Voice","WhatsApp","Email","Silent Authentication","security"],"install":[{"cmd":"pip install vonage-verify","lang":"bash","label":"Install vonage-verify"},{"cmd":"pip install vonage","lang":"bash","label":"Install main Vonage SDK (recommended)"}],"dependencies":[{"reason":"The `vonage-verify` library is intended to be used as a sub-package of the main `vonage` SDK. The `vonage.Client` object is required to interact with the Verify API.","package":"vonage","optional":false}],"imports":[{"symbol":"VerifyRequest","correct":"from vonage_verify import VerifyRequest"},{"symbol":"SmsChannel","correct":"from vonage_verify import SmsChannel"},{"symbol":"SilentAuthChannel","correct":"from vonage_verify import SilentAuthChannel"},{"symbol":"EmailChannel","correct":"from vonage_verify import EmailChannel"},{"symbol":"ChannelType","correct":"from vonage_verify import ChannelType"},{"note":"The Vonage client is part of the main `vonage` package, not `vonage-verify`.","wrong":"from vonage_verify import Vonage","symbol":"Vonage","correct":"from vonage import Vonage"},{"note":"The authentication object is part of the main `vonage` package.","wrong":"from vonage_verify import Auth","symbol":"Auth","correct":"from vonage import Auth"}],"quickstart":{"code":"import os\nfrom vonage import Vonage, Auth\nfrom vonage_verify import VerifyRequest, SmsChannel\n\n# Ensure VONAGE_API_KEY and VONAGE_API_SECRET are set as environment variables\nclient = Vonage(Auth(key=os.environ.get('VONAGE_API_KEY', ''), secret=os.environ.get('VONAGE_API_SECRET', '')))\n\n# Define the recipient's phone number and brand name\nrecipient_number = os.environ.get('VONAGE_TEST_NUMBER', '1234567890') # Use E.164 format\nbrand_name = 'MyTestApp'\n\n# Create an SMS channel for verification\nsms_channel = SmsChannel(to=recipient_number)\n\n# Construct the verification request with a workflow (SMS in this case)\nparams = {\n    'brand': brand_name,\n    'workflow': [sms_channel],\n}\nverify_request = VerifyRequest(**params)\n\ntry:\n    # Start the verification process\n    response = client.verify.start_verification(verify_request)\n    print(f\"Verification initiated. Request ID: {response['request_id']}\")\n\n    # In a real application, you would now prompt the user for the code\n    # and then call client.verify.check_code(request_id=response['request_id'], code=user_entered_code)\n\n    # Example of checking a code (assuming '1234' was sent and entered)\n    # user_entered_code = '1234'\n    # check_response = client.verify.check_code(request_id=response['request_id'], code=user_entered_code)\n    # if check_response['status'] == '0':\n    #     print('Verification successful!')\n    # else:\n    #     print(f\"Verification failed: {check_response['error_text']}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to initialize the Vonage client and send a verification request via SMS using `vonage-verify`. It uses environment variables for API credentials for security. The process involves creating a `VerifyRequest` with a specified `brand` and `workflow` (e.g., `SmsChannel`), and then calling `client.verify.start_verification`."},"warnings":[{"fix":"Migrate your integration to use the `vonage-verify` package with the `SilentAuthChannel` within a `workflow`. Refer to the Vonage Verify Migration Guide for detailed steps.","message":"The legacy Number Verification API is deprecated and will sunset on September 30, 2025. Users should migrate to the unified Verify API with Silent Authentication for improved features and fallbacks.","severity":"breaking","affected_versions":"<= 2.0.0 (for those using the old API)"},{"fix":"If you are managing 10DLC brands, you may need to update your existing brands and provide a 'verification email' to re-verify the brand. This might involve triggering a `POST /brands/:brandId/revet` request via the Vonage APIs. Consult Vonage's 10DLC documentation for the latest requirements.","message":"Changes to 10DLC brand verification processes, including the 'Authentication+' requirement for public profit brands, are being introduced (tentative date: October 17, 2024). This requires a 2FA email verification.","severity":"breaking","affected_versions":"All versions, as this is an API-level change"},{"fix":"Always install `pip install vonage` and instantiate your `vonage.Client` first. Then, import specific models like `VerifyRequest`, `SmsChannel`, etc., from `vonage_verify` as needed.","message":"The `vonage-verify` package is a component of the broader `vonage` Python SDK. It's recommended to install and use the main `vonage` package, and interact with verify functionality through the `vonage_client.verify` object. Directly instantiating classes from `vonage-verify` (e.g., `VerifyRequest`) is correct, but the client itself should come from `vonage`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"You need to import `Vonage` from the main `vonage` package: `from vonage import Vonage, Auth`.","cause":"Attempting to use `Vonage` class directly after only importing `vonage_verify`.","error":"NameError: name 'Vonage' is not defined"},{"fix":"Verify that your `VONAGE_API_KEY` and `VONAGE_API_SECRET` environment variables are correctly set and correspond to active credentials in your Vonage account dashboard. Ensure they are accessible by your Python script.","cause":"Incorrect `VONAGE_API_KEY` or `VONAGE_API_SECRET` environment variables, or hardcoded values are wrong/missing.","error":"vonage.errors.AuthenticationError: Could not authenticate with Vonage. Check your credentials."},{"fix":"Review the Vonage API documentation or the `vonage-verify` model definitions to ensure all mandatory parameters for your chosen verification workflow are provided and correctly formatted. For example, the `to` field for channels should be in E.164 format.","cause":"A required parameter (e.g., 'brand', 'workflow', 'to' within a channel) was omitted or an invalid value was provided in the `VerifyRequest` constructor.","error":"vonage.errors.VerifyError: Your request is incomplete and missing the mandatory parameter $parameter"},{"fix":"Wait for the ongoing verification to complete, fail, or expire before initiating a new one for the same number. Implement logic to check for existing verifications if this is a common scenario in your application.","cause":"An active verification request already exists for the target phone number.","error":"vonage.errors.VerifyError: Concurrent verifications to the same number are not allowed"},{"fix":"This can indicate suspicious activity or network-level blocking. Review Vonage's documentation on the Verify Anti-Fraud System and consider checking if the number is on an unsupported network. If this persists for legitimate users, contact Vonage support.","cause":"The phone number is blocked by the Vonage Anti-Fraud System or carrier-specific restrictions.","error":"vonage.errors.VerifyError: The number you are trying to verify is blacklisted for verification. (Error Code 7)"}]}