{"id":9399,"library":"vonage-subaccounts","title":"Vonage Subaccounts API Client","description":"This library provides a Pythonic interface for interacting with the Vonage Subaccounts API, allowing users to programmatically manage subaccounts. It is currently at version 1.0.4 and is officially maintained, with releases typically following updates to the Vonage Subaccounts API itself.","status":"active","version":"1.0.4","language":"en","source_language":"en","source_url":"https://github.com/Vonage/vonage-subaccounts-python","tags":["vonage","subaccounts","api-client","telecom","saas"],"install":[{"cmd":"pip install vonage-subaccounts","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core Vonage API client required for authentication and underlying HTTP requests.","package":"vonage","optional":false}],"imports":[{"symbol":"VonageSubaccounts","correct":"from vonage_subaccounts import VonageSubaccounts"},{"note":"This is the core Vonage client, not part of the subaccounts library itself, but essential for initialization.","symbol":"Client","correct":"from vonage import Client"}],"quickstart":{"code":"import os\nfrom vonage import Client\nfrom vonage_subaccounts import VonageSubaccounts\n\n# Ensure API_KEY and API_SECRET are set as environment variables\n# e.g., export VONAGE_API_KEY='YOUR_API_KEY'\n# e.g., export VONAGE_API_SECRET='YOUR_API_SECRET'\napi_key = os.environ.get(\"VONAGE_API_KEY\", \"YOUR_API_KEY\")\napi_secret = os.environ.get(\"VONAGE_API_SECRET\", \"YOUR_API_SECRET\")\n\nif not api_key or api_key == \"YOUR_API_KEY\" or not api_secret or api_secret == \"YOUR_API_SECRET\":\n    print(\"Please set VONAGE_API_KEY and VONAGE_API_SECRET environment variables or replace placeholders.\")\n    exit(1)\n\n# Initialize the core Vonage client\nvonage_client = Client(key=api_key, secret=api_secret)\n\n# Initialize the Vonage Subaccounts client\nsubaccounts_client = VonageSubaccounts(client=vonage_client)\n\ntry:\n    # Example: List all subaccounts\n    print(\"Listing all subaccounts:\")\n    all_subaccounts = subaccounts_client.get_all_subaccounts()\n    for subaccount in all_subaccounts:\n        print(f\"- ID: {subaccount.get('id')}, Name: {subaccount.get('name')}, Balance: {subaccount.get('balance')}\")\n\n    # Example: Create a new subaccount (uncomment to run)\n    # print(\"\\nCreating a new subaccount...\")\n    # new_subaccount = subaccounts_client.create_subaccount(name=\"My Test Subaccount via API\")\n    # print(f\"Created subaccount ID: {new_subaccount.get('id')}, Name: {new_subaccount.get('name')}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    # Common errors might include authentication issues, invalid parameters, or API rate limits.","lang":"python","description":"This quickstart demonstrates how to initialize the Vonage client and then the Subaccounts client to list existing subaccounts. It requires your Vonage API Key and Secret, preferably from environment variables."},"warnings":[{"fix":"Ensure `vonage.Client(key=..., secret=...)` is created and then `VonageSubaccounts(client=vonage_client)` is called.","message":"This library wraps the core `vonage` Python client. You *must* initialize `vonage.Client` first and pass it to `VonageSubaccounts`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Refer to the release notes of the `vonage` library and the Vonage Subaccounts API documentation for migration guides.","message":"As this library is a wrapper for the Vonage API, changes in the underlying Vonage API or the `vonage` Python client (major versions) might introduce breaking changes to how requests are made or responses are structured.","severity":"breaking","affected_versions":"Depends on `vonage` client and Vonage API versions."},{"fix":"Use your master Vonage API Key and Secret when initializing the `vonage.Client`.","message":"API Key and Secret must be for the *primary* account to manage subaccounts. Using subaccount credentials will result in permission errors for subaccount management operations.","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":"Double-check method names against the documentation. Ensure the client is correctly initialized.","cause":"Attempting to call a method that doesn't exist or is misspelled.","error":"AttributeError: 'VonageSubaccounts' object has no attribute 'get_all_subaccounts'"},{"fix":"Provide your Vonage API Key and Secret, either directly or via environment variables, when initializing `vonage.Client`.","cause":"The `vonage.Client` was initialized without valid API credentials or they were not correctly passed.","error":"vonage.exceptions.VonageError: API Key and Secret are required"},{"fix":"Initialize `vonage_subaccounts.VonageSubaccounts` with a `vonage.Client` instance, e.g., `VonageSubaccounts(client=vonage_client)`.","cause":"The `VonageSubaccounts` class was initialized without passing an instance of `vonage.Client`.","error":"TypeError: __init__ missing 1 required positional argument: 'client'"},{"fix":"Verify that you are using the API Key and Secret for your *primary* Vonage account to manage subaccounts.","cause":"The API key and secret provided do not have the necessary permissions to perform the requested subaccount operation. This often happens if subaccount credentials are used instead of master account credentials.","error":"requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: ..."}]}