{"id":2367,"library":"zenpy","title":"ZenPy: Python Wrapper for Zendesk API","description":"ZenPy is an actively maintained Python wrapper for the Zendesk Support, Chat, and Help Center APIs. It simplifies programmatic interaction with Zendesk, offering a Pythonic interface, object caching, and lazy attribute evaluation to minimize API calls. The library is currently at version 2.0.57 and sees frequent updates, typically on a monthly or bi-monthly basis.","status":"active","version":"2.0.57","language":"en","source_language":"en","source_url":"https://github.com/facetoe/zenpy","tags":["api-wrapper","zendesk","saas","customer-support"],"install":[{"cmd":"pip install zenpy","lang":"bash","label":"Install ZenPy"}],"dependencies":[],"imports":[{"symbol":"Zenpy","correct":"from zenpy import Zenpy"},{"symbol":"Ticket","correct":"from zenpy.lib.api_objects import Ticket"}],"quickstart":{"code":"import os\nfrom zenpy import Zenpy\nfrom zenpy.lib.api_objects import Ticket\n\n# Authenticate using environment variables (API Token is recommended)\ncreds = {\n    'email': os.environ.get('ZENDESK_EMAIL', 'your_email@example.com'),\n    'token': os.environ.get('ZENDESK_API_TOKEN', 'your_zendesk_api_token'),\n    'subdomain': os.environ.get('ZENDESK_SUBDOMAIN', 'your_subdomain')\n}\n\n# Create a Zenpy instance\ntry:\n    zenpy_client = Zenpy(**creds)\n    print(\"Successfully connected to Zendesk.\")\n\n    # Create a new ticket\n    new_ticket = zenpy_client.tickets.create(\n        Ticket(\n            subject=\"Urgent: Coffee Machine Broken!\",\n            description=\"The office coffee machine is completely out of order.\"\n        )\n    )\n    print(f\"Created ticket with ID: {new_ticket.id}\")\n\n    # Retrieve and print a ticket's subject\n    retrieved_ticket = zenpy_client.tickets(id=new_ticket.id)\n    print(f\"Retrieved ticket subject: {retrieved_ticket.subject}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize the ZenPy client using API token authentication (recommended) and then create and retrieve a basic Zendesk ticket. Ensure `ZENDESK_EMAIL`, `ZENDESK_API_TOKEN`, and `ZENDESK_SUBDOMAIN` environment variables are set."},"warnings":[{"fix":"Migrate to Zendesk API tokens or OAuth for authentication. Update your `Zenpy` initialization to use `token` or `oauth_token` instead of `password`.","message":"Zendesk is deprecating password authentication for API calls. ZenPy version 2.0.53 introduced warnings (or errors, configurable via `password_treatment_level`) when using passwords. Relying solely on email and password will eventually break your integration.","severity":"breaking","affected_versions":">=2.0.53"},{"fix":"Upgrade your Python environment to Python 3.6 or newer.","message":"Support for Python 3.5 was dropped in ZenPy version 2.0.49. Older Python environments using this version will experience compatibility issues.","severity":"breaking","affected_versions":">=2.0.49"},{"fix":"Ensure your Chat API interactions are compatible with Zendesk Chat API v2 endpoints and the updated ZenPy `zenpy_client.chats` methods, rather than direct `zopim` references.","message":"The ZenPy Chat API now exclusively uses Zendesk API v2, deprecating direct reliance on the `zopim` endpoint that was previously used. This change was implemented in version 2.0.54.","severity":"gotcha","affected_versions":">=2.0.54"},{"fix":"Manually chunk your bulk operations to stay within Zendesk's documented limits (e.g., 100 objects per call) and handle `APIException` for robust error management.","message":"Zendesk's bulk API operations typically have a limit (e.g., 100 objects per call). ZenPy does not automatically paginate or regulate this limit. Exceeding it can lead to `APIException` errors or silent truncation of your data by Zendesk.","severity":"gotcha","affected_versions":"All 2.x versions"},{"fix":"Consider setting `raise_on_ratelimit=True` in the `Zenpy` constructor to handle `RateLimitError` exceptions programmatically, allowing you to implement custom retry logic (e.g., with backoff) or reschedule tasks. You can also configure `ratelimit_budget` or `proactive_ratelimit`.","message":"ZenPy supports rate limiting controls but requires proper configuration to avoid HTTP 429 (Too Many Requests) errors. By default, it may sleep and retry, but this can cause long delays.","severity":"gotcha","affected_versions":"All 2.x versions"},{"fix":"Be aware of the default 100-object fetch when using slices. For extensive pagination, refer to the documentation on 'Cursor Based Generators' or 'Incremental Exports' which may offer more robust solutions.","message":"ZenPy's pagination via Python slices has limitations. It always pulls the first 100 objects by default for certain endpoints and does not support negative slicing or multiple accesses of the same slice reliably.","severity":"gotcha","affected_versions":"All 2.x versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}