Getting started overview
Integrating with the Zendesk API enables programmatic interaction with Zendesk Support, allowing developers to automate workflows, synchronize data, and build custom applications. This guide provides a structured approach to initial setup: creating a Zendesk account, acquiring necessary API credentials, and executing a foundational API request. The process typically involves administrative configuration within the Zendesk dashboard to enable API access and generate authentication tokens.
Before making your first API call, ensure you have an active Zendesk account with administrative privileges. Zendesk offers various product suites, and API access is generally available across its paid plans, starting with the Suite Team tier (Zendesk Pricing Page). While Zendesk does not offer a free tier for its core products, trial accounts can be used for development and testing purposes.
The following table summarizes the initial steps to get started with the Zendesk API:
| Step | What to do | Where |
|---|---|---|
| 1. Sign Up for Zendesk | Register for a trial or paid Zendesk account. | Zendesk Homepage |
| 2. Enable API Access | Navigate to API settings and enable token access. | Zendesk Admin Center > Apps and Integrations > APIs > Zendesk API |
| 3. Generate API Token | Create a new API token for authentication. | Zendesk Admin Center > Apps and Integrations > APIs > Zendesk API |
| 4. Construct Request | Formulate an HTTP request with appropriate headers and body. | Your preferred coding environment or API client |
| 5. Execute Request | Send the request to a Zendesk API endpoint. | Your preferred coding environment or API client |
Create an account and get keys
To access the Zendesk API, an active Zendesk account is required. If you do not have one, you can sign up for a trial account directly from the Zendesk homepage. Once your account is set up, you will need to enable API access and generate an API token for authentication.
Follow these steps to obtain your API token:
- Log in to your Zendesk Support account as an administrator.
- Navigate to the Zendesk Admin Center. This is typically accessible by clicking the "Admin" icon (gear) in the left sidebar and then selecting "Admin Center" if it's not the default landing page.
- In the Admin Center, go to Apps and integrations > APIs > Zendesk API. You can find detailed instructions in the Zendesk API documentation on enabling API token access.
- Ensure that "Token access" is enabled.
- Click the Add API token button.
- A new API token will be generated. Copy this token immediately, as it will only be shown once. If you lose it, you will need to generate a new token.
The API token, along with your Zendesk account email and subdomain, forms the basis of authentication for most API requests. Alternatively, for more advanced applications requiring user consent and broader access, Zendesk supports OAuth 2.0. The OAuth 2.0 specification is an industry standard for delegated authorization, allowing third-party applications to access user resources without exposing user credentials directly.
Your first request
Once you have your Zendesk subdomain (e.g., yourcompany.zendesk.com), your email address, and your API token, you can make your first API request. A common initial request is to list tickets, which validates your credentials and connectivity.
The Zendesk API uses Basic Authentication when using an API token. The username is your Zendesk account email, and the password is your API token. The base URL for your API requests will be https://yoursubdomain.zendesk.com/api/v2/.
Here's an example using curl to fetch a list of tickets. Replace {your_subdomain}, {your_email}, and {your_api_token} with your actual credentials.
curl "https://{your_subdomain}.zendesk.com/api/v2/tickets.json" \
-u "{your_email}/token:{your_api_token}"
This command sends a GET request to the /api/v2/tickets.json endpoint, authenticated with your email and API token. If successful, the response will be a JSON object containing an array of ticket objects, similar to this simplified example:
{
"tickets": [
{
"id": 1,
"subject": "My printer is on fire!",
"status": "open",
"created_at": "2024-01-01T12:00:00Z",
"requester_id": 123456789,
"url": "https://{your_subdomain}.zendesk.com/api/v2/tickets/1.json"
},
{
"id": 2,
"subject": "Can't log in",
"status": "pending",
"created_at": "2024-01-02T10:30:00Z",
"requester_id": 987654321,
"url": "https://{your_subdomain}.zendesk.com/api/v2/tickets/2.json"
}
],
"count": 2,
"next_page": null,
"previous_page": null
}
A successful response with a 200 OK HTTP status code and a JSON payload confirms that your API access is correctly configured and your credentials are valid. Zendesk provides comprehensive API reference documentation for all available endpoints and expected response formats.
Common next steps
After successfully making your first API call, you can explore more advanced functionalities and integrate the API into your applications. Common next steps include:
-
Exploring more endpoints: The Zendesk API allows you to manage users, organizations, custom fields, and more. Refer to the Zendesk API reference to understand the full range of available endpoints, including those for ticket creation and updates, user management, and custom ticket fields.
-
Implementing OAuth: For production applications that interact with multiple Zendesk accounts or require user-specific permissions, consider implementing OAuth 2.0 for authentication. This is a more secure and scalable method for granting API access without sharing user credentials directly.
-
Using official SDKs: Zendesk offers official SDKs for platforms like Android, iOS, and Web. These SDKs can simplify development by abstracting HTTP requests and handling authentication. Explore the Zendesk SDK documentation for more information.
-
Handling pagination and rate limits: When retrieving large datasets, Zendesk APIs often paginate results. You will need to implement logic to fetch all pages. Additionally, be aware of Zendesk's API rate limits to prevent your application from being temporarily blocked. Implement retry logic with exponential backoff for robust error handling.
-
Webhooks: For real-time notifications about events in Zendesk (e.g., a new ticket created or updated), configure Zendesk webhooks. This allows your application to receive push notifications rather than constantly polling the API.
-
Security best practices: Always secure your API tokens and credentials. Avoid hardcoding them directly into your application code. Use environment variables or secure secret management systems. For more on general API security, refer to resources like the Google Cloud API security best practices guide.
Troubleshooting the first call
Encountering issues during your first API call is common. Here are some troubleshooting tips for the Zendesk API:
-
401 Unauthorized: This is typically an authentication issue. Double-check your API token for typos or ensure it hasn't been revoked. Verify that the email address used in the basic auth header is correct and associated with the Zendesk account. Ensure "Token access" is enabled in the Zendesk Admin Center, as described in the API token access documentation.
-
403 Forbidden: This status code often indicates that the user associated with the API token does not have the necessary permissions to perform the requested action. Verify that the user has administrator privileges or the required role to access the specific endpoint.
-
404 Not Found: Check your Zendesk subdomain for accuracy. Ensure the API endpoint path is correct (e.g.,
/api/v2/tickets.json). A common mistake is using the wrong version of the API or an incorrect resource name. Refer to the API reference for correct endpoint paths. -
Invalid JSON or request body: If you're making a POST or PUT request, ensure your request body is valid JSON and matches the expected schema for the endpoint. Syntax errors in JSON can lead to processing failures. Use a JSON linter to validate your payload.
-
Rate limits: If you send too many requests in a short period, Zendesk may temporarily block your requests and return a
429 Too Many Requestsstatus code. Implement backoff strategies or reduce the frequency of your calls. The Zendesk API documentation on rate limits provides specific thresholds and handling advice. -
Network issues: Confirm that your network configuration allows outbound HTTP/HTTPS requests to Zendesk's servers. Proxy settings or firewalls can sometimes interfere with API communication.
-
Check Zendesk API status: Occasionally, Zendesk services may experience outages. Check the Zendesk status page for any ongoing incidents that might affect API availability.