Python Client SDK Generated by Speakeasy.
Project description
python-zendesk
Provided by botBrains. This SDK is generated for the Zendesk Support API openapi spec (also known as Zendesk Ticketing API). We slightly modified it to comply with the OpenAPI spec and to work with the speakeasy codegen tool, as well as adding partial pagination support.
How to regenerate the SDK
sh scripts/generate.sh
How to generate the website mdx
curl https://<CRAWLER_URL>/crawl?urls[]=https://developer.zendesk.com/api-reference/ticketing/introduction/&limit=100&render_mode=no-js&include_globs[]=https://developer.zendesk.com/api-reference/ticketing/**&include_only_selectors[]=.documentContent__DocumentContent-sc-196ktpv-0
Summary
Support API: Zendesk Support API endpoints
Table of Contents
SDK Installation
[!NOTE] Python version upgrade policy
Once a Python version reaches its official end of life date, a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
The SDK can be installed with uv, pip, or poetry package managers.
uv
uv is a fast Python package installer and resolver, designed as a drop-in replacement for pip and pip-tools. It's recommended for its speed and modern Python tooling capabilities.
uv add python-zendesk
PIP
PIP is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.
pip install python-zendesk
Poetry
Poetry is a modern tool that simplifies dependency management and package publishing by using a single pyproject.toml file to handle project metadata and dependencies.
poetry add python-zendesk
Shell and script usage with uv
You can use this SDK in a Python shell with uv and the uvx command that comes with it like so:
uvx --from python-zendesk python
It's also possible to write a standalone Python script without needing to set up a whole project like so:
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.9"
# dependencies = [
# "python-zendesk",
# ]
# ///
from zendesk import Zendesk
sdk = Zendesk(
# SDK arguments
)
# Rest of script here...
Once that is saved to a file, you can run it with uv run script.py where
script.py can be replaced with the actual file name.
IDE Support
PyCharm
Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.
SDK Example Usage
Example
# Synchronous Example
from zendesk import Zendesk, models
with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search(name="Johnny Agent")
# Handle response
print(res)
The same SDK client can also be used to make asynchronous requests by importing asyncio.
# Asynchronous Example
import asyncio
from zendesk import Zendesk, models
async def main():
async with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
res = await z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search_async(name="Johnny Agent")
# Handle response
print(res)
asyncio.run(main())
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
| Name | Type | Scheme | Environment Variable |
|---|---|---|---|
usernamepassword |
http | HTTP Basic | ZENDESK_USERNAMEZENDESK_PASSWORD |
You can set the security parameters through the security optional parameter when initializing the SDK client instance. For example:
from zendesk import Zendesk, models
with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search(name="Johnny Agent")
# Handle response
print(res)
Available Resources and Operations
Available methods
AccountSettings
- show_account_settings - Show Settings
- update_account_settings - Update Account Settings
ActivityStream
- list_activities - List Activities
- show_activity - Show Activity
- count_activities - Count Activities
ApprovalRequests
- create_approval_request - Create an Approval Request
- show_approval_request - Show Approval Request
- update_decision_approval_request - Update Approval Request Status
- search_approvals - Get Approvals by Approval Workflow Id
ApprovalWorkflowInstances
- create_approval_workflow_instance - Create Approval Workflow Instance
AssigneeFieldAssignableAgents
- list_assignee_field_assignable_groups_and_agents_search - List assignable groups and agents based on query matched against name
- list_assignee_field_assignable_groups - List assignable groups on the AssigneeField
- list_assignee_field_assignable_group_agents - List assignable agents from a group on the AssigneeField
AssigneeFieldAssignableGroups
- list_assignee_field_assignable_groups_and_agents_search - List assignable groups and agents based on query matched against name
Attachments
- show_attachment - Show Attachment
- update_attachment - Update Attachment for Malware
- redact_comment_attachment - Redact Comment Attachment
- upload_files - Upload Files
- delete_upload - Delete Upload
AuditLogs
- list_audit_logs - List Audit Logs
- show_audit_log - Show Audit Log
- export_audit_logs - Export Audit Logs
Automations
- list_automations - List Automations
- create_automation - Create Automation
- show_automation - Show Automation
- update_automation - Update Automation
- delete_automation - Delete Automation
- list_active_automations - List Active Automations
- bulk_delete_automations - Bulk Delete Automations
- search_automations - Search Automations
- update_many_automations - Update Many Automations
Basics
- open_ticket_in_agent_browser - Open Ticket in Agent's Browser
- open_users_profile_in_agent_browser - Open a User's Profile in an Agent's Browser
- create_ticket_or_voicemail_ticket - Create Ticket or Voicemail Ticket
Bookmarks
- list_bookmarks - List Bookmarks
- create_bookmark - Create Bookmark
- delete_bookmark - Delete Bookmark
BrandAgents
- list_brand_agents - List Brand Agent Memberships
- show_brand_agent_by_id - Show Brand Agent Membership
Brands
- list_brands - List Brands
- create_brand - Create Brand
- show_brand - Show a Brand
- update_brand - Update a Brand
- delete_brand - Delete a Brand
- check_host_mapping_validity_for_existing_brand - Check Host Mapping Validity for an Existing Brand
- check_host_mapping_validity - Check Host Mapping Validity
ChannelFramework
- report_channelback_error - Report Channelback Error to Zendesk
- push_content_to_support - Push Content to Support
- validate_token - Validate Token
ConversationLog
- list_conversation_log_for_ticket - List Conversation log for Ticket
CustomObjectFields
- list_custom_object_fields - List Custom Object Fields
- create_custom_object_field - Create Custom Object Field
- show_custom_object_field - Show Custom Object Field
- update_custom_object_field - Update Custom Object Field
- delete_custom_object_field - Delete Custom Object Field
- reorder_custom_object_fields - Reorder Custom Fields of an Object
- custom_object_fields_limit - Custom Object Fields Limit
CustomObjectRecords
- custom_object_record_bulk_jobs - Custom Object Record Bulk Jobs
- list_custom_object_records - List Custom Object Records
- create_custom_object_record - Create Custom Object Record
- upsert_custom_object_record_by_external_id_or_name - Set Custom Object Record by External Id Or Name
- delete_custom_object_record_by_external_id_or_name - Delete Custom Object Record by External Id Or Name
- show_custom_object_record - Show Custom Object Record
- update_custom_object_record - Update Custom Object Record
- delete_custom_object_record - Delete Custom Object Record
- autocomplete_custom_object_record_search - Autocomplete Custom Object Record Search
- count_custom_object_records - Count Custom Object Records
- search_custom_object_records - Search Custom Object Records
- filtered_search_custom_object_records - Filtered Search of Custom Object Records
- custom_object_records_limit - Custom Object Records Limit
CustomObjects
- list_custom_objects - List Custom Objects
- create_custom_object - Create Custom Object
- show_custom_object - Show Custom Object
- update_custom_object - Update Custom Object
- delete_custom_object - Delete Custom Object
- custom_objects_limit - Custom Objects Limit
CustomRoles
- list_custom_roles - List Custom Roles
- create_custom_role - Create Custom Role
- show_custom_role_by_id - Show Custom Role
- update_custom_role_by_id - Update Custom Role
- delete_custom_role_by_id - Delete Custom Role
CustomTicketStatuses
- bulk_update_default_custom_status - Bulk Update Default Custom Ticket Status
- list_custom_statuses - List Custom Ticket Statuses
- create_custom_status - Create Custom Ticket Status
- show_custom_status - Show Custom Ticket Status
- update_custom_status - Update Custom Ticket Status
- create_ticket_form_statuses_for_custom_status - Create Ticket Form Statuses for a Custom Status
DeletionSchedules
- list_deletion_schedules - List Deletion Schedules
- create_deletion_schedule - Create Deletion Schedule
- get_deletion_schedule - Get Deletion Schedule
- update_deletion_schedule - Update Deletion Schedule
- delete_deletion_schedule - Delete Deletion Schedule
DynamicContent
- list_dynamic_contents - List Items
- create_dynamic_content - Create Item
- show_dynamic_content_item - Show Item
- update_dynamic_content_item - Update Item
- delete_dynamic_content_item - Delete Item
- show_many_dynamic_contents - Show Many Items
DynamicContentItemVariants
- dynamic_content_list_variants - List Variants
- create_dynamic_content_variant - Create Variant
- show_dynamic_content_variant - Show Variant
- update_dynamic_content_variant - Update Variant
- delete_dynamic_content_variant - Delete Variant
- create_many_dynamic_content_variants - Create Many Variants
- update_many_dynamic_content_variants - Update Many Variants
EmailNotifications
- list_email_notifications - List Email Notifications
- show_email_notification - Show Email Notification
- show_many_email_notifications - Show Many Email Notifications
EssentialsCard
- show_essentials_card - Show Essentials Card
- update_essentials_card - Update Essentials Card
- delete_essentials_card - Delete Essentials Card
- show_essentials_cards - List of Essentials Cards
GlobalClients
- list_global_o_auth_clients - List Global OAuth Clients
GrantTypeTokens
- create_token_for_grant_type - Create Token for Grant Type
GroupMemberships
- list_group_memberships - List Memberships
- create_group_membership - Create Membership
- show_group_membership_by_id - Show Membership
- delete_group_membership - Delete Membership
- list_assignable_group_memberships - List Assignable Memberships
- group_membership_bulk_create - Bulk Create Memberships
- group_membership_bulk_delete - Bulk Delete Memberships
- group_membership_set_default - Set Membership as Default
GroupSLAPolicies
- list_group_sla_policies - List Group SLA Policies
- create_group_sla_policy - Create Group SLA Policy
- show_group_sla_policy - Show Group SLA Policy
- update_group_sla_policy - Update Group SLA Policy
- delete_group_sla_policy - Delete Group SLA Policy
- retrieve_group_sla_policy_filter_definition_items - Retrieve Supported Filter Definition Items
- reorder_group_sla_policies - Reorder Group SLA Policies
Groups
- list_groups - List Groups
- create_group - Create Group
- show_group_by_id - Show Group
- update_group - Update Group
- delete_group - Delete Group
- list_assignable_groups - List Assignable Groups
- count_groups - Count Groups
IncrementalExport
- incremental_sample_export - Incremental Sample Export
- incremental_organization_export - Incremental Organization Export
- incremental_ticket_events - Incremental Ticket Event Export
- incremental_ticket_export_time - Incremental Ticket Export, Time Based
- incremental_ticket_export_cursor - Incremental Ticket Export, Cursor Based
- incremental_user_export_time - Incremental User Export, Time Based
- incremental_user_export_cursor - Incremental User Export, Cursor Based
IncrementalSkillBasedRouting
- incremental_skil_based_routing_attribute_values_export - Incremental Attributes Values Export
- incremental_skil_based_routing_attributes_export - Incremental Attributes Export
- incremental_skil_based_routing_instance_values_export - Incremental Instance Values Export
JobStatuses
- list_job_statuses - List Job Statuses
- show_job_status - Show Job Status
- show_many_job_statuses - Show Many Job Statuses
- bulk_set_agent_attribute_values_job - Bulk Set Agent Attribute Values Job
Locales
- list_locales - List Locales
- show_locale_by_id - Show Locale
- list_locales_for_agent - List Locales for Agent
- show_current_locale - Show Current Locale
- detect_best_locale - Detect Best Language for User
- list_available_public_locales - List Available Public Locales
LookupRelationships
- get_sources_by_target - Get sources by target
- get_relationship_filter_definitions - Filter Definitions
Macros
- list_macros - List Macros
- create_macro - Create Macro
- show_macro - Show Macro
- update_macro - Update Macro
- delete_macro - Delete Macro
- show_changes_to_ticket - Show Changes to Ticket
- list_macro_attachments - List Macro Attachments
- create_associated_macro_attachment - Create Macro Attachment
- list_macros_actions - List Supported Actions for Macros
- list_active_macros - List Active Macros
- create_macro_attachment - Create Unassociated Macro Attachment
- show_macro_attachment - Show Macro Attachment
- list_macro_categories - List Macro Categories
- list_macro_action_definitions - List Macro Action Definitions
- delete_many_macros - Bulk Delete Macros
- show_derived_macro - Show Macro Replica
- search_macro - Search Macros
- update_many_macros - Update Many Macros
- show_ticket_after_changes - Show Ticket After Changes
OAuthClients
- list_o_auth_clients - List Clients
- create_o_auth_client - Create Client
- show_client - Show Client
- update_client - Update Client
- delete_client - Delete Client
- client_generate_secret - Generate Secret
OAuthTokens
- list_o_auth_tokens - List Tokens
- create_o_auth_token - Create Token
- show_token - Show Token
- revoke_o_auth_token - Revoke Token
ObjectTriggers
- list_object_triggers - List Object Triggers
- create_object_trigger - Create Object Trigger
- get_object_trigger - Show Object Trigger
- update_object_trigger - Update Object Trigger
- delete_object_trigger - Delete Object Trigger
- list_active_object_triggers - List Active Object Triggers
- list_object_triggers_definitions - List Object Trigger Action and Condition Definitions
- delete_many_object_triggers - Delete Many Object Triggers
- search_object_triggers - Search Object Triggers
- update_many_object_triggers - Update Many Object Triggers
OmnichannelRoutingQueues
- list_queues - List queues
- create_queue - Create Queue
- show_queue_by_id - Show Queue
- update_queue - Update Queue
- delete_queue - Delete Queue
- list_queue_definitions - List Queue Definitions
- reorder_queues - Reorder Queues
OrganizationFields
- list_organization_fields - List Organization Fields
- create_organization_field - Create Organization Field
- reorder_organization_field - Reorder Organization Field
OrganizationMemberships
- list_organization_memberships - List Memberships
- create_organization_membership - Create Membership
- show_organization_membership_by_id - Show Membership
- delete_organization_membership - Delete Membership
- create_many_organization_memberships - Create Many Memberships
- delete_many_organization_memberships - Bulk Delete Memberships
- set_organization_membership_as_default - Set Membership as Default
- unassign_organization - Unassign Organization
- set_organization_as_default - Set Organization as Default
OrganizationSubscriptions
- list_organization_subscriptions - List Organization Subscriptions
- create_organization_subscription - Create Organization Subscription
- show_organization_subscription - Show Organization Subscription
- delete_organization_subscription - Delete Organization Subscription
Organizations
- show_organization_merge - Show Organization Merge
- list_organizations - List Organizations
- create_organization - Create Organization
- show_organization - Show Organization
- update_organization - Update Organization
- delete_organization - Delete Organization
- create_organization_merge - Merge Organization With Another Organization
- list_organization_merges - List Organization Merges
- organization_related - Show Organization's Related Information
- autocomplete_organizations - Autocomplete Organizations
- count_organizations - Count Organizations
- create_many_organizations - Create Many Organizations
- create_or_update_organization - Create Or Update Organization
- delete_many_organizations - Bulk Delete Organizations
- search_organizations - Search Organizations
- show_many_organizations - Show Many Organizations
- update_many_organizations - Update Many Organizations
PushNotificationDevices
- push_notification_devices - Bulk Unregister Push Notification Devices
Requests
- list_requests - List Requests
- create_request - Create Request
- show_request - Show Request
- update_request - Update Request
- list_comments - Listing Comments
- show_comment - Getting Comments
- search_requests - Search Requests
Reseller
- create_trial_account - Create Trial Account
- verify_subdomain_availability - Verify Subdomain Availability
ResourceCollections
- list_resource_collections - List Resource Collections
- create_resource_collection - Create Resource Collection
- retrieve_resource_collection - Show Resource Collection
- update_resource_collection - Update Resource Collection
- delete_resource_collection - Delete Resource Collection
SatisfactionRatings
- list_satisfaction_ratings - List Satisfaction Ratings
- show_satisfaction_rating - Show Satisfaction Rating
- count_satisfaction_ratings - Count Satisfaction Ratings
- create_ticket_satisfaction_rating - Create a Satisfaction Rating
SatisfactionReasons
- list_satisfaction_rating_reasons - List Reasons for Satisfaction Rating
- show_satisfaction_ratings - Show Reason for Satisfaction Rating
Search
- list_search_results - List Search Results
- count_search_results - Show Results Count
- export_search_results - Export Search Results
Sessions
- list_sessions - List Sessions
- bulk_delete_sessions_by_user_id - Bulk Delete Sessions
- show_session - Show Session
- delete_session - Delete Session
- delete_authenticated_session - Delete the Authenticated Session
- show_currently_authenticated_session - Show the Currently Authenticated Session
- renew_current_session - Renew the current session
SharingAgreements
- list_sharing_agreements - List Sharing Agreements
- create_sharing_agreement - Create Sharing Agreement
- show_sharing_agreement - Show a Sharing Agreement
- update_sharing_agreement - Update a Sharing Agreement
- delete_sharing_agreement - Delete a Sharing Agreement
SkillBasedRouting
- list_a_gent_attribute_values - List Agent Attribute Values
- set_agent_attribute_values - Set Agent Attribute Values
- list_many_agents_attribute_values - List Attribute Values for Many Agents
- bulk_set_agent_attribute_values_job - Bulk Set Agent Attribute Values Job
- list_account_attributes - List Account Attributes
- create_attribute - Create Attribute
- show_attribute - Show Attribute
- update_attribute - Update Attribute
- delete_attribute - Delete Attribute
- list_attribute_values - List Attribute Values for an Attribute
- create_attribute_value - Create Attribute Value
- show_attribute_value - Show Attribute Value
- update_attribute_value - Update Attribute Value
- delete_attribute_value - Delete Attribute Value
- list_routing_attribute_definitions - List Routing Attribute Definitions
- list_tickets_fullfilled_by_user - List Tickets Fulfilled by a User
- list_ticket_attribute_values - List Ticket Attribute Values
- set_ticket_attribute_values - Set Ticket Attribute Values
SLAPolicies
- list_sla_policies - List SLA Policies
- create_sla_policy - Create SLA Policy
- show_sla_policy - Show SLA Policy
- update_sla_policy - Update SLA Policy
- delete_sla_policy - Delete SLA Policy
- retrieve_sla_policy_filter_definition_items - Retrieve Supported Filter Definition Items
- reorder_sla_policies - Reorder SLA Policies
SupportAddresses
- list_support_addresses - List Support Addresses
- create_support_address - Create Support Address
- show_support_address - Show Support Address
- update_support_address - Update Support Address
- delete_recipient_address - Delete Support Address
- verify_support_address_forwarding - Verify Support Address Forwarding
SuspendedTickets
- list_suspended_tickets - List Suspended Tickets
- show_suspended_tickets - Show Suspended Ticket
- delete_suspended_ticket - Delete Suspended Ticket
- recover_suspended_ticket - Recover Suspended Ticket
- suspended_tickets_attachments - Suspended Ticket Attachments
- delete_suspended_tickets - Delete Multiple Suspended Tickets
- export_suspended_tickets - Export Suspended Tickets
- recover_suspended_tickets - Recover Multiple Suspended Tickets
Tags
- autocomplete_tags - Search Tags
- list_tags - List Tags
- count_tags - Count Tags
- list_ticket_tags - List Ticket Tags
- set_ticket_tags - Set Ticket Tags
- add_ticket_tags - Add Tags
- remove_ticket_tags - Remove Ticket Tags
- list_organization_tags - List Organization Tags
- set_organization_tags - Set Organization Tags
- add_organization_tags - Add Organization Tags
- remove_organization_tags - Remove Organization Tags
- list_user_tags - List User Tags
- set_user_tags - Set User Tags
- add_user_tags - Add User Tags
- remove_user_tags - Remove User Tags
TargetFailures
- list_target_failures - List Target Failures
- show_target_failure - Show Target Failure
Targets
- list_targets - List Targets
- create_target - Create Target
- show_target - Show Target
- update_target - Update Target
- delete_target - Delete Target
TicketAudits
- list_ticket_audits - List All Ticket Audits
- list_audits_for_ticket - List Audits for a Ticket
- show_ticket_audit - Show Audit
- make_ticket_comment_private_from_audits - Change a Comment From Public To Private
- count_audits_for_ticket - Count Audits for a Ticket
TicketComments
- redact_chat_comment_attachment - Redact Chat Comment Attachment
- redact_chat_comment - Redact Chat Comment
- redact_ticket_comment_in_agent_workspace - Redact Ticket Comment In Agent Workspace
- list_ticket_comments - List Comments
- make_ticket_comment_private - Make Comment Private
- redact_string_in_comment - Redact String in Comment
- count_ticket_comments - Count Ticket Comments
TicketFields
- list_ticket_fields - List Ticket Fields
- create_ticket_field - Create Ticket Field
- show_ticketfield - Show Ticket Field
- update_ticket_field - Update Ticket Field
- delete_ticket_field - Delete Ticket Field
- list_ticket_field_options - List Ticket Field Options
- create_or_update_ticket_field_option - Create or Update Ticket Field Option
- show_ticket_field_option - Show Ticket Field Option
- delete_ticket_field_option - Delete Ticket Field Option
- count_ticket_fields - Count Ticket Fields
- reorder_ticket_fields - Reorder Ticket Fields
TicketFormStatuses
- create_ticket_form_statuses_for_custom_status - Create Ticket Form Statuses for a Custom Status
- list_ticket_form_statuses - List Ticket Form Statuses
- show_many_ticket_form_statuses - Show Many Ticket Form Statuses
- ticket_form_ticket_form_statuses - List Ticket Form Statuses of a Ticket Form
- create_ticket_form_statuses - Create Ticket Form Statuses
- update_ticket_form_statuses - Bulk Update Ticket Form Statuses of a Ticket Form
- delete_ticket_form_statuses - Delete Ticket Form Statuses
- update_ticket_form_status_by_id - Update Ticket Form Status By Id
- delete_ticket_form_status_by_id - Delete Ticket Form Status By Id
TicketForms
- list_ticket_forms - List Ticket Forms
- create_ticket_form - Create Ticket Form
- show_ticket_form - Show Ticket Form
- update_ticket_form - Update Ticket Form
- delete_ticket_form - Delete Ticket Form
- clone_ticket_form - Clone an Already Existing Ticket Form
- ticket_form_ticket_form_statuses - List Ticket Form Statuses of a Ticket Form
- create_ticket_form_statuses - Create Ticket Form Statuses
- update_ticket_form_statuses - Bulk Update Ticket Form Statuses of a Ticket Form
- update_ticket_form_status_by_id - Update Ticket Form Status By Id
- reorder_ticket_forms - Reorder Ticket Forms
- show_many_ticket_forms - Show Many Ticket Forms
TicketImport
- ticket_import - Ticket Import
- ticket_bulk_import - Ticket Bulk Import
TicketMetricEvents
- list_ticket_metric_events - List Ticket Metric Events
TicketMetrics
- list_ticket_metrics - List Ticket Metrics
- show_ticket_metrics - Show Ticket Metrics
TicketSkips
- record_new_skip - Record a New Skip for the Current User
- list_ticket_skips - List Ticket Skips
Tickets
- list_deleted_tickets - List Deleted Tickets
- delete_ticket_permanently - Delete Ticket Permanently
- restore_deleted_ticket - Restore a Previously Deleted Ticket
- bulk_permanently_delete_tickets - Delete Multiple Tickets Permanently
- bulk_restore_deleted_tickets - Restore Previously Deleted Tickets in Bulk
- list_ticket_problems - List Ticket Problems
- autocomplete_problems - Autocomplete Problems
- list_tickets - List Tickets
- create_ticket - Create Ticket
- show_ticket - Show Ticket
- update_ticket - Update Ticket
- delete_ticket - Delete Ticket
- list_ticket_collaborators - List Collaborators for a Ticket
- list_ticket_email_c_cs - List Email CCs for a Ticket
- list_ticket_followers - List Followers for a Ticket
- list_ticket_incidents - List Ticket Incidents
- mark_ticket_as_spam_and_suspend_requester - Mark Ticket as Spam and Suspend Requester
- merge_tickets_into_target_ticket - Merge Tickets into Target Ticket
- ticket_related_information - Ticket Related Information
- count_tickets - Count Tickets
- tickets_create_many - Create Many Tickets
- bulk_delete_tickets - Bulk Delete Tickets
- mark_many_tickets_as_spam - Bulk Mark Tickets as Spam
- tickets_show_many - Show Multiple Tickets
- tickets_update_many - Update Many Tickets
TriggerCategories
- list_trigger_categories - List Ticket Trigger Categories
- create_trigger_category - Create Ticket Trigger Category
- show_trigger_category_by_id - Show Ticket Trigger Category
- update_trigger_category - Update Ticket Trigger Category
- delete_trigger_category - Delete Ticket Trigger Category
- batch_operate_trigger_categories - Create Batch Job for Ticket Trigger Categories
Triggers
- list_triggers - List Ticket Triggers
- create_trigger - Create Trigger
- get_trigger - Show Ticket Trigger
- update_trigger - Update Ticket Trigger
- delete_trigger - Delete Ticket Trigger
- list_trigger_revisions - List Ticket Trigger Revisions
- trigger_revision - Show Ticket Trigger Revision
- list_active_triggers - List Active Ticket Triggers
- list_trigger_action_condition_definitions - List Ticket Trigger Action and Condition Definitions
- delete_many_triggers - Bulk Delete Ticket Triggers
- reorder_triggers - Reorder Ticket Triggers
- search_triggers - Search Ticket Triggers
- update_many_triggers - Update Many Ticket Triggers
UserFields
- list_user_fields - List User Fields
- create_user_field - Create User Field
- reorder_user_field - Reorder User Field
UserIdentities
- list_user_identities - List Identities
- create_user_identity - Create Identity
- show_user_identity - Show Identity
- update_user_identity - Update Identity
- delete_user_identity - Delete Identity
- make_user_identity_primary - Make Identity Primary
- request_user_verfication - Request User Verification
- verify_user_identity - Verify Identity
UserPasswords
- set_user_password - Set a User's Password
- change_own_password - Change Your Password
- get_user_password_requirements - List password requirements
Users
- list_deleted_users - List Deleted Users
- show_deleted_user - Show Deleted User
- permanently_delete_user - Permanently Delete User
- count_deleted_users - Count Deleted Users
- list_users - List Users
- create_user - Create User
- show_user - Show User
- update_user - Update User
- delete_user - Delete User
- show_user_compliance_deletion_statuses - Show Compliance Deletion Statuses
- merge_end_users - Merge End Users
- show_user_related - Show User Related Information
- autocomplete_users - Autocomplete Users
- count_users - Count Users
- create_many_users - Create Many Users
- create_or_update_user - Create Or Update User
- create_or_update_many_users - Create Or Update Many Users
- destroy_many_users - Bulk Delete Users
- logout_many_users - Logout many users
- show_current_user - Show Self
- request_user_create - Request User Create
- search_users - Search Users
- show_many_users - Show Many Users
- update_many_users - Update Many Users
Views
- list_views - List Views
- create_view - Create View
- show_view - Show View
- update_view - Update View
- delete_view - Delete View
- get_view_count - Count Tickets in View
- execute_view - Execute View
- export_view - Export View
- list_tickets_from_view - List Tickets From a View
- list_active_views - List Active Views
- list_compact_views - List Views - Compact
- count_views - Count Views
- get_view_counts - Count Tickets in Views
- bulk_delete_views - Bulk Delete Views
- preview_views - Preview Views
- preview_count - Preview Ticket Count
- search_views - Search Views
- list_views_by_id - List Views By ID
- update_many_views - Update Many Views
WebhookInvocations
- list_webhook_invocations - List Webhook Invocations
- list_webhook_invocation_attempts - List Webhook Invocation Attempts
Webhooks
- list_webhooks - List Webhooks
- create_or_clone_webhook - Create or Clone Webhook
- test_webhook - Test Webhook
- show_webhook - Show Webhook
- update_webhook - Update Webhook
- patch_webhook - Patch Webhook
- delete_webhook - Delete Webhook
- show_webhook_signing_secret - Show Webhook Signing Secret
- reset_webhook_signing_secret - Reset Webhook Signing Secret
Workspaces
- list_workspaces - List Workspaces
- create_workspace - Create Workspace
- show_workspace - Show Workspace
- update_workspace - Update Workspace
- delete_workspace - Delete Workspace
- destroy_many_workspaces - Bulk Delete Workspaces
- reorder_workspaces - Reorder Workspaces
XChannel
- list_monitored_twitter_handles - List Monitored X Handles
- show_monitored_twitter_handle - Show Monitored X Handle
- create_ticket_from_tweet - Create Ticket from Tweet
- getting_twicket_status - List Ticket statuses
Pagination
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
returned response object will have a Next method that can be called to pull down the next group of results. If the
return value of Next is None, then there are no more pages to be fetched.
Here's an example of one such pagination call:
from zendesk import Zendesk, models
with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.lookup_relationships.get_sources_by_target(target_type="zen:custom_object:apartment", target_id=1234, field_id=1234, source_type="zen:custom_object:apartment", page_size=100)
while res is not None:
# Handle items
res = res.next()
Retries
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply provide a RetryConfig object to the call:
from zendesk import Zendesk, models
from zendesk.utils import BackoffStrategy, RetryConfig
with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search(name="Johnny Agent",
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
# Handle response
print(res)
If you'd like to override the default retry strategy for all operations that support retries, you can use the retry_config optional parameter when initializing the SDK:
from zendesk import Zendesk, models
from zendesk.utils import BackoffStrategy, RetryConfig
with Zendesk(
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search(name="Johnny Agent")
# Handle response
print(res)
Error Handling
ZendeskError is the base class for all HTTP error responses. It has the following properties:
| Property | Type | Description |
|---|---|---|
err.message |
str |
Error message |
err.status_code |
int |
HTTP response status code eg 404 |
err.headers |
httpx.Headers |
HTTP response headers |
err.body |
str |
HTTP body. Can be empty string if no body is returned. |
err.raw_response |
httpx.Response |
Raw HTTP response |
err.data |
Optional. Some errors may contain structured data. See Error Classes. |
Example
from zendesk import Zendesk, errors, models
with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
res = None
try:
res = z_client.tags.list_ticket_tags(ticket_id=123456)
# Handle response
print(res)
except errors.ZendeskError as e:
# The base class for HTTP error responses
print(e.message)
print(e.status_code)
print(e.body)
print(e.headers)
print(e.raw_response)
# Depending on the method different errors may be thrown
if isinstance(e, errors.Error):
print(e.data.code) # str
print(e.data.detail) # Optional[str]
print(e.data.id) # Optional[str]
print(e.data.links) # Optional[models.ErrorLinks]
print(e.data.source) # Optional[models.ErrorSource]
Error Classes
Primary error:
ZendeskError: The base class for HTTP error responses.
Less common errors (11)
Network errors:
httpx.RequestError: Base class for request errors.httpx.ConnectError: HTTP client was unable to make a request to a server.httpx.TimeoutException: HTTP request timed out.
Inherit from ZendeskError:
Error: The specified resource was not found. Applicable to 12 of 508 methods.*ErrorResponse: Applicable to 8 of 508 methods.*Errors: Applicable to 7 of 508 methods.*SkillBasedRoutingAttributeValuesError: Bad Request. Status code400. Applicable to 2 of 508 methods.*BatchJobResponseError: The response to the batch job. Status code400. Applicable to 1 of 508 methods.*RecoverSuspendedTicketUnprocessableContentResponseError: Recovery failed response. Status code422. Applicable to 1 of 508 methods.*ResponseValidationError: Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via thecauseattribute.
* Check the method documentation to see if the error is applicable.
Server Selection
Server Variables
The default server https://{subdomain}.{domain}.com contains variables and is set to https://example.zendesk.com by default. To override default values, the following parameters are available when initializing the SDK client instance:
| Variable | Parameter | Default | Description |
|---|---|---|---|
domain |
domain: str |
"zendesk" |
|
subdomain |
subdomain: str |
"example" |
Example
from zendesk import Zendesk, models
with Zendesk(
server_idx=0,
domain="zendesk",
subdomain="example",
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search(name="Johnny Agent")
# Handle response
print(res)
Override Server URL Per-Client
The default server can be overridden globally by passing a URL to the server_url: str optional parameter when initializing the SDK client instance. For example:
from zendesk import Zendesk, models
with Zendesk(
server_url="https://example.zendesk.com",
security=models.Security(
username="",
password="",
),
) as z_client:
res = z_client.assignee_field_assignable_groups.list_assignee_field_assignable_groups_and_agents_search(name="Johnny Agent")
# Handle response
print(res)
Custom HTTP Client
The Python SDK makes API calls using the httpx HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.
Depending on whether you are using the sync or async version of the SDK, you can pass an instance of HttpClient or AsyncHttpClient respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.
This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of httpx.Client or httpx.AsyncClient directly.
For example, you could specify a header for every request that this sdk makes as follows:
from zendesk import Zendesk
import httpx
http_client = httpx.Client(headers={"x-custom-header": "someValue"})
s = Zendesk(client=http_client)
or you could wrap the client with your own custom logic:
from zendesk import Zendesk
from zendesk.httpclient import AsyncHttpClient
import httpx
class CustomClient(AsyncHttpClient):
client: AsyncHttpClient
def __init__(self, client: AsyncHttpClient):
self.client = client
async def send(
self,
request: httpx.Request,
*,
stream: bool = False,
auth: Union[
httpx._types.AuthTypes, httpx._client.UseClientDefault, None
] = httpx.USE_CLIENT_DEFAULT,
follow_redirects: Union[
bool, httpx._client.UseClientDefault
] = httpx.USE_CLIENT_DEFAULT,
) -> httpx.Response:
request.headers["Client-Level-Header"] = "added by client"
return await self.client.send(
request, stream=stream, auth=auth, follow_redirects=follow_redirects
)
def build_request(
self,
method: str,
url: httpx._types.URLTypes,
*,
content: Optional[httpx._types.RequestContent] = None,
data: Optional[httpx._types.RequestData] = None,
files: Optional[httpx._types.RequestFiles] = None,
json: Optional[Any] = None,
params: Optional[httpx._types.QueryParamTypes] = None,
headers: Optional[httpx._types.HeaderTypes] = None,
cookies: Optional[httpx._types.CookieTypes] = None,
timeout: Union[
httpx._types.TimeoutTypes, httpx._client.UseClientDefault
] = httpx.USE_CLIENT_DEFAULT,
extensions: Optional[httpx._types.RequestExtensions] = None,
) -> httpx.Request:
return self.client.build_request(
method,
url,
content=content,
data=data,
files=files,
json=json,
params=params,
headers=headers,
cookies=cookies,
timeout=timeout,
extensions=extensions,
)
s = Zendesk(async_client=CustomClient(httpx.AsyncClient()))
Resource Management
The Zendesk class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a context manager and reuse it across the application.
from zendesk import Zendesk, models
def main():
with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
# Rest of application here...
# Or when using async:
async def amain():
async with Zendesk(
security=models.Security(
username="",
password="",
),
) as z_client:
# Rest of application here...
Debugging
You can setup your SDK to emit debug logs for SDK requests and responses.
You can pass your own logger class directly into your SDK.
from zendesk import Zendesk
import logging
logging.basicConfig(level=logging.DEBUG)
s = Zendesk(debug_logger=logging.getLogger("zendesk"))
You can also enable a default debug logger by setting an environment variable ZENDESK_DEBUG to true.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_zendesk-0.2.3.tar.gz.
File metadata
- Download URL: python_zendesk-0.2.3.tar.gz
- Upload date:
- Size: 436.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
112987928f3a69b7f49a62f7ce6bf226eca9e760871670f5df8c1a1b9e410916
|
|
| MD5 |
0c25b130fca9bfb8aa7b7dc7177b60d8
|
|
| BLAKE2b-256 |
a60fd1de4348e70100b906b5f4ffa20c7741b16869fe53538d7b58400ee0aa68
|
File details
Details for the file python_zendesk-0.2.3-py3-none-any.whl.
File metadata
- Download URL: python_zendesk-0.2.3-py3-none-any.whl
- Upload date:
- Size: 955.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cfbd5eff79563345bde149d556007a56028a34dc2282ff7d26b30b6744aacbe
|
|
| MD5 |
ed476447dcfc574267404c87009e4829
|
|
| BLAKE2b-256 |
218d17f95c82c63bdf6a21624d62021999ef7b63d21e3e84f144acea89537278
|