{"id":9395,"library":"vonage-network-number-verification","title":"Vonage Network Number Verification","description":"The `vonage-network-number-verification` Python library (version 1.0.2) provides a client for interacting with the Vonage Number Verification Network API. It enables programmatic access to verify phone numbers at a network level, offering details like reachability and porting status. This package acts as a specialized client, relying on the core `vonage` Python SDK (versions `>=4.0.0, <5.0.0`) for underlying API communication and authentication. While the main `vonage` SDK sees frequent updates, this specific client package has a less frequent release cadence, with its latest version (1.0.2) released on 2023-09-22.","status":"active","version":"1.0.2","language":"en","source_language":"en","source_url":"https://github.com/Vonage/vonage-network-number-verification-python","tags":["vonage","api","number verification","telecom","phone number","network"],"install":[{"cmd":"pip install vonage-network-number-verification","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for underlying API client functionality, authentication, and communication with Vonage APIs.","package":"vonage","optional":false}],"imports":[{"note":"This client is a standalone package, not a sub-module of the main `vonage` SDK.","wrong":"from vonage.number_verification import Client","symbol":"Client","correct":"from vonage_network_number_verification import Client"},{"symbol":"VerifyNumberRequest","correct":"from vonage_network_number_verification.models import VerifyNumberRequest"}],"quickstart":{"code":"import os\nfrom vonage import Client as VonageCoreClient\nfrom vonage_network_number_verification import Client as NumberVerificationClient\nfrom vonage_network_number_verification.models import VerifyNumberRequest\n\n# Your Vonage API key and secret\nVONAGE_API_KEY = os.environ.get(\"VONAGE_API_KEY\", \"YOUR_API_KEY\")\nVONAGE_API_SECRET = os.environ.get(\"VONAGE_API_SECRET\", \"YOUR_API_SECRET\")\n\n# Initialize the core Vonage client (required by the number verification client)\nvonage_client = VonageCoreClient(key=VONAGE_API_KEY, secret=VONAGE_API_SECRET)\n\n# Initialize the Network Number Verification client\nnv_client = NumberVerificationClient(vonage_client=vonage_client)\n\n# Define the request to verify a number\nrequest_body = VerifyNumberRequest(\n    type=\"phone\", # Required: 'phone'\n    number=\"447700900000\" # Required: The phone number to verify\n)\n\ntry:\n    # Make the API call\n    response = nv_client.post_verify_number(request_body)\n\n    # Print the raw response for inspection\n    print(f\"\\nNetwork Number Verification Response:\\n{response.model_dump_json(indent=2)}\")\n\n    # Access specific fields\n    if response.request_id:\n        print(f\"\\nRequest ID: {response.request_id}\")\n    if response.port_id_check_status:\n        print(f\"Port ID Check Status: {response.port_id_check_status}\")\n    if response.reachability_status:\n        print(f\"Reachability Status: {response.reachability_status}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize the Vonage Network Number Verification client and make a request to verify a phone number. It requires your Vonage API Key and Secret, which are used to initialize the underlying `vonage.Client` instance. The response contains various network-level details about the number."},"warnings":[{"fix":"Before upgrading the main `vonage` SDK to a new major version, check for a compatible `vonage-network-number-verification` release or consult the official documentation for compatibility notes.","message":"This package relies on `vonage >= 4.0.0, < 5.0.0`. If the main `vonage` SDK is updated to a `5.x.x` version (or newer major version), this package may become incompatible or break due to API changes in the underlying dependency.","severity":"breaking","affected_versions":"< 1.0.3 (potentially all current versions)"},{"fix":"Ensure you are using the correct API for your specific use case. If you need general number data, use `vonage-number-insight`. For network status, use `vonage-network-number-verification`.","message":"Do not confuse `vonage-network-number-verification` with `vonage-number-insight`. They are distinct Vonage APIs serving different purposes. Number Insight provides general information about a number (carrier, type, roaming status), while Network Number Verification provides network-level checks like number reachability and porting status.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always initialize the core `vonage.Client` with `key` and `secret` parameters when creating an instance for `vonage-network-number-verification`. Ensure these credentials have the necessary permissions for the Number Verification Network API.","message":"The `vonage-network-number-verification` client requires an initialized `vonage.Client` instance, which primarily uses API Key and Secret for authentication. This differs from some other Vonage APIs (e.g., Voice, Video) that frequently use JWT authentication.","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":"Install `vonage-network-number-verification` (`pip install vonage-network-number-verification`) and import its `Client` class directly: `from vonage_network_number_verification import Client`.","cause":"The `vonage-network-number-verification` client is a separate package and not a sub-module of the main `vonage` SDK. You are trying to import it from the wrong path.","error":"ImportError: cannot import name 'Client' from 'vonage.number_verification'"},{"fix":"Install the package using pip: `pip install vonage-network-number-verification`.","cause":"The `vonage-network-number-verification` package is not installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'vonage_network_number_verification'"},{"fix":"First, create a `vonage.Client` instance with your API key and secret, then pass it to the `NumberVerificationClient`: `from vonage import Client as VonageCoreClient; vonage_client = VonageCoreClient(key='YOUR_API_KEY', secret='YOUR_API_SECRET'); nv_client = NumberVerificationClient(vonage_client=vonage_client)`.","cause":"The `NumberVerificationClient` from `vonage-network-number-verification` expects an initialized `vonage.Client` instance to be passed during its creation.","error":"TypeError: Client.__init__ missing 1 required positional argument: 'vonage_client'"},{"fix":"Double-check your Vonage API Key and Secret in your Vonage dashboard. Ensure they are correctly configured in your code (e.g., environment variables) and that your account has access to the Number Verification Network API.","cause":"The API key or secret used to initialize the underlying `vonage.Client` are incorrect, expired, or do not have the necessary permissions to access the Number Verification Network API.","error":"vonage.exceptions.VonageServerException: Request Failed: Bad credentials"}]}