{"id":5341,"library":"netsuitesdk","title":"NetSuite SDK for Python","description":"Netsuite-sdk-py is a Python SDK for accessing NetSuite resources via the NetSuite SOAP web service SuiteTalk. It leverages the `zeep` library internally but abstracts its complexity, providing a simplified interface for interacting with NetSuite APIs. The library is actively maintained with frequent releases, currently at version 3.1.2.","status":"active","version":"3.1.2","language":"en","source_language":"en","source_url":"https://github.com/fylein/netsuite-sdk-py","tags":["netsuite","erp","soap","api","accounting","business-management"],"install":[{"cmd":"pip install netsuitesdk","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core SOAP client library used internally to interact with NetSuite's SuiteTalk web service.","package":"zeep","optional":false}],"imports":[{"note":"The primary client class is exposed directly from the top-level package, not its internal module.","wrong":"from netsuitesdk.internal.client import NetSuiteClient","symbol":"NetSuiteConnection","correct":"from netsuitesdk import NetSuiteConnection"}],"quickstart":{"code":"import os\nfrom netsuitesdk import NetSuiteConnection\nfrom netsuitesdk.exceptions import NetSuiteLoginError\n\n# Ensure these environment variables are set with your NetSuite TBA credentials\nNS_ACCOUNT = os.getenv('NS_ACCOUNT', 'YOUR_ACCOUNT_ID')\nNS_CONSUMER_KEY = os.getenv('NS_CONSUMER_KEY', 'YOUR_CONSUMER_KEY')\nNS_CONSUMER_SECRET = os.getenv('NS_CONSUMER_SECRET', 'YOUR_CONSUMER_SECRET')\nNS_TOKEN_KEY = os.getenv('NS_TOKEN_KEY', 'YOUR_TOKEN_KEY')\nNS_TOKEN_SECRET = os.getenv('NS_TOKEN_SECRET', 'YOUR_TOKEN_SECRET')\n\nif 'YOUR' in NS_ACCOUNT:\n    print(\"Please set NS_ACCOUNT, NS_CONSUMER_KEY, NS_CONSUMER_SECRET, NS_TOKEN_KEY, NS_TOKEN_SECRET environment variables.\")\nelse:\n    try:\n        nc = NetSuiteConnection(\n            account=NS_ACCOUNT,\n            consumer_key=NS_CONSUMER_KEY,\n            consumer_secret=NS_CONSUMER_SECRET,\n            token_key=NS_TOKEN_KEY,\n            token_secret=NS_TOKEN_SECRET\n        )\n        print(f\"Successfully connected to NetSuite account: {nc.account}\")\n\n        # Example: Fetch all currencies\n        currencies = nc.currencies.get_all()\n        print(f\"Found {len(currencies)} currencies. First 3: {currencies[:3]}\")\n\n    except NetSuiteLoginError as e:\n        print(f\"NetSuite login failed: {e}\")\n    except Exception as e:\n        print(f\"An unexpected error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to establish a Token-Based Authentication (TBA) connection to NetSuite using the `netsuitesdk`. It reads credentials from environment variables and then performs a simple query to fetch a list of currencies. NetSuite requires TBA for highly privileged roles."},"warnings":[{"fix":"If necessary, explicitly pass the `wsdl_version` parameter when initializing `NetSuiteConnection`, e.g., `NetSuiteConnection(..., wsdl_version='2019_1')`.","message":"Starting from version 3.0.0, the default WSDL version used by the SDK changed from '2019_1' to '2024_1'. If your NetSuite account is older or if your integration explicitly relies on an older WSDL version, you might experience compatibility issues.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Review your code for direct references to 'Passport Complex Type' and adjust your authentication or record handling methods as per the updated SDK and NetSuite API documentation. Token-Based Authentication (TBA) is the recommended approach.","message":"Version 3.0.1 removed the 'Passport Complex Type'. Integrations that were directly utilizing this specific complex type will break.","severity":"breaking","affected_versions":">=3.0.1"},{"fix":"Always use Token-Based Authentication (TBA) with a dedicated integration role that has only the necessary permissions (not an Administrator role if 2FA is active). Regularly check token validity and ensure the associated NetSuite user account is active.","message":"Authentication failures are common, often due to NetSuite's Two-Factor Authentication (2FA) for highly privileged roles, revoked or expired access tokens, or insufficient role permissions. Roles used for integration must have 'Web Services access' and 'Log in using Access Tokens' permissions.","severity":"gotcha","affected_versions":"All"},{"fix":"Ensure the role assigned to your integration user has 'Full' access to all relevant permissions (e.g., Permissions, Reports, Lists, Setup, Custom Records) for the data you intend to access or modify. Use NetSuite's Records Browser to confirm correct internal field names.","message":"Incorrect NetSuite role permissions can lead to 'INSUFFICIENT_PERMISSION' errors or silently missing data. Even if authenticated, the user role might lack access to specific record types or fields required for an operation.","severity":"gotcha","affected_versions":"All"},{"fix":"Always verify internal IDs and field names using the NetSuite Records Browser or developer tools. Avoid hardcoding values that are subject to change in NetSuite configurations.","message":"Using incorrect internal IDs or field names for NetSuite records is a frequent source of errors (e.g., 'INVALID_FIELD_FOR_RECORD_TYPE'). NetSuite often uses specific internal field names that may not match display names.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}