Blog

Zendesk API token deprecation: how to switch to OAuth

If you have a script, a cron job or an internal integration that calls the Zendesk API with an API token, it now has an end date. Zendesk stopped letting accounts create new API tokens on October 27, 2026, and on April 30, 2027 every remaining token stops working for good.

This guide covers how to find what still depends on a token, which OAuth setup to replace it with, and the exact steps to switch a script over. I ran every OAuth step and code sample below against a real Zendesk account before publishing.

What's changing, and when

Zendesk announced the change in its developer changelog on June 1, 2026:

  • July 28, 2026: tokens that hadn't been used for 30 days were deactivated, and accounts created on or after that date can't use API tokens at all.
  • October 27, 2026: no account can create new API tokens, in Admin Center or through the API.
  • April 30, 2027: every remaining token is permanently deactivated, and the API token pages disappear from Admin Center. There's no reactivating them after that.

It covers the APIs that accept API tokens today, which Zendesk lists as the Ticketing, Help Center and Voice APIs. Zendesk's stated reason is security: an API token works like a password for the whole account and can be used to act as anyone on it, admins included. OAuth tokens expire and can be limited to specific scopes.

Find what still uses a token

Start with the list in Admin Center under Apps and integrations → APIs → API tokens, which shows the tokens your account still has. Zendesk's docs also say that on Enterprise plans, each token's menu has View audit log, which records when the token was created, deactivated or reactivated. That's a history of the token itself, not a record of the calls made with it.

So the list tells you which tokens exist, not what uses them. To find the callers:

  • Search your code and secret stores. API token auth uses the username {email}/token with the token as the password. Code usually passes those separately, such as auth=(f"{email}/token", token) in Python or -u you@example.com/token:$TOKEN with curl, so search for /token along with variable names like ZENDESK_API_TOKEN or ZENDESK_TOKEN. Also look for stored Authorization: Basic headers, which carry the same credentials in base64. Check CI secrets, cron hosts, serverless functions and any old VMs.
  • Ask your vendors. If a third-party tool asked you for an API token, ask the vendor how they're handling the change. Many already support OAuth.
  • Test a token's blast radius safely. Zendesk's docs say that deactivating a token, instead of deleting it, stops every call that uses it right away, and that you can reactivate it afterward. Do it in a quiet window, watch what fails, then reactivate it until the replacement is ready.

Pick the OAuth setup that fits

What calls the API Use Token acts as Refresh token
A script, cron job or middleware with no person involved Confidential OAuth client, client credentials grant The admin who created the OAuth client No
A tool where each person signs in with their own Zendesk account OAuth client, authorization code grant The person who signed in Yes
An app you sell to many Zendesk customers A global OAuth client (Zendesk's guide) Each customer's authorizing user Yes

Most homegrown scripts belong in the first row, so the rest of this guide covers that one.

Two related cases have their own rules. Zendesk's docs say Zendesk apps lost the "password" type for installation settings on April 29, 2026, and should use OAuth or secure settings instead. Integrations built on Zendesk Integration Services (ZIS) connect through ZIS OAuth connections rather than API tokens.

Step by step: move a script to client credentials

1. Decide whose account owns it

A client-credentials token acts as the admin who created the OAuth client, and Zendesk's docs say those tokens stop working if that admin loses access. If the person who sets this up leaves, every script using their client breaks.

Create the client while signed in as a dedicated integration admin if you can. If an extra admin seat isn't an option, at least record which admin owns each client, so offboarding that person includes moving their clients.

2. Create a confidential OAuth client

In Admin Center, go to Apps and integrations → APIs → OAuth clients → Add OAuth client.

  • Client kind: Confidential. That's what allows the client credentials grant.
  • Redirect URLs: required by the form even though client credentials never uses it. Zendesk accepts HTTPS addresses or a localhost address; I used http://localhost:3000/callback.
  • Scopes: pick the narrowest set the script needs, such as tickets:read.

Save it, then copy the secret right away. Zendesk shows it in full only once.

Don't worry if the new client shows as Inactive in the list, with no way to switch it on. It changes to Active by itself once it issues its first token.

3. Get an access token

Send the client ID and secret to the token endpoint on your Zendesk subdomain (use yoursubdomain.zendesk.com, not a custom host-mapped domain):

#!/usr/bin/env sh
# Get a Zendesk OAuth access token with the client credentials grant.
# Needs ZENDESK_SUBDOMAIN, ZENDESK_CLIENT_ID and ZENDESK_CLIENT_SECRET in the environment.
# The JSON body is piped in on stdin, so the secret never shows up in your process list.
set -eu

printf '{"grant_type":"client_credentials","client_id":"%s","client_secret":"%s","scope":"%s"}' \
  "$ZENDESK_CLIENT_ID" "$ZENDESK_CLIENT_SECRET" "${ZENDESK_SCOPE:-tickets:read}" |
  curl -sS "https://${ZENDESK_SUBDOMAIN}.zendesk.com/oauth/tokens" \
    -H "Content-Type: application/json" \
    --data @-

The response looks like this (token shortened):

{"access_token": "…", "expires_in": 1800, "scope": "tickets:read", "token_type": "bearer"}

The token lasts 30 minutes (expires_in is in seconds), and there's no refresh token. When it expires, you ask for a new one the same way. If 30 minutes doesn't suit a job, add "expires_in" to the request to choose a lifetime. Zendesk's docs allow 300 seconds to 172,800 (48 hours); a 300-second token worked as expected in my tests.

To keep just the token for the next step, pull it out of the response:

ACCESS_TOKEN=$(sh get_token.sh | python3 -c 'import json, sys; print(json.load(sys.stdin)["access_token"])')

If the request fails, Zendesk answers with an error instead of a token, such as {"error":"invalid_client", …} for a wrong secret. The line above then prints KeyError: 'access_token', exits with an error and leaves ACCESS_TOKEN empty, so check the exit status (or run your script with set -e) before using it.

4. Call the API with it

Swap your old Basic auth header for a Bearer token:

curl "https://yoursubdomain.zendesk.com/api/v2/tickets.json?per_page=1" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

5. Handle expiry in code

A long-running script will outlive its token, so it needs to get a new one. An expired token gets an HTTP 401 with "error": "invalid_token" and a description that reads "The access token provided is expired, revoked, malformed or invalid for other reasons."

This Python version (standard library only) caches the token, replaces it a minute before it expires, and retries once with a fresh token if the API answers 401:

"""Call the Zendesk API with an OAuth client-credentials token instead of an API token.

Needs ZENDESK_SUBDOMAIN, ZENDESK_CLIENT_ID and ZENDESK_CLIENT_SECRET in the environment
(and optionally ZENDESK_SCOPE, default "tickets:read"). Python 3.8+, standard library only.
"""
import json
import os
import time
import urllib.error
import urllib.request

SUBDOMAIN = os.environ["ZENDESK_SUBDOMAIN"]
BASE_URL = f"https://{SUBDOMAIN}.zendesk.com"


def get_token(subdomain, client_id, client_secret, scope, expires_in=None):
    """Request a new access token. Client credentials tokens come without a refresh token."""
    body = {
        "grant_type": "client_credentials",
        "client_id": client_id,
        "client_secret": client_secret,
        "scope": scope,
    }
    if expires_in:
        body["expires_in"] = expires_in  # seconds, 300 to 172800
    req = urllib.request.Request(
        f"https://{subdomain}.zendesk.com/oauth/tokens",
        data=json.dumps(body).encode(),
        headers={"Content-Type": "application/json"},
        method="POST",
    )
    with urllib.request.urlopen(req) as resp:
        return json.load(resp)


_cache = {"token": None, "expires_at": 0.0}


def _access_token(force_new=False):
    # Get a fresh token when there isn't one, when it's within a minute of expiring, or when asked.
    if force_new or not _cache["token"] or time.time() > _cache["expires_at"] - 60:
        data = get_token(
            SUBDOMAIN,
            os.environ["ZENDESK_CLIENT_ID"],
            os.environ["ZENDESK_CLIENT_SECRET"],
            os.environ.get("ZENDESK_SCOPE", "tickets:read"),
        )
        _cache["token"] = data["access_token"]
        # If Zendesk doesn't say when the token expires, assume 30 minutes and rely on the 401 retry.
        _cache["expires_at"] = time.time() + (data.get("expires_in") or 1800)
    return _cache["token"]


def api_get(path):
    """GET a Zendesk API path. On a 401 (expired or revoked token), get a new token and retry once."""
    for attempt in (1, 2):
        req = urllib.request.Request(
            BASE_URL + path,
            headers={"Authorization": f"Bearer {_access_token(force_new=attempt == 2)}"},
        )
        try:
            with urllib.request.urlopen(req) as resp:
                return json.load(resp)
        except urllib.error.HTTPError as err:
            if err.code == 401 and attempt == 1:
                continue
            raise


if __name__ == "__main__":
    tickets = api_get("/api/v2/tickets.json?per_page=1").get("tickets", [])
    print(f"OK: the API call worked and returned {len(tickets)} ticket(s)")

Things that will trip you up

  • Scopes are enforced on every call. A token with only tickets:read that tries to create a ticket gets a 403 that says exactly what's missing: "You are missing the following required scopes: tickets:write, write."
  • A typo in a scope doesn't fail where you'd expect. Ask for a scope Zendesk doesn't recognize and you still get a token. Every API call made with it then fails with a 403, so a misspelled scope looks like a permissions problem, not a token problem.
  • The secret is shown once. If you lose it, you'll need to make a new one.
  • "Expire tokens" can't be undone. Zendesk's docs say that on OAuth clients created before April 30, 2026, turning on token expiration is permanent and also applies to tokens already issued. Newer clients expire tokens by default.
  • Use the current token endpoint. The older POST /api/v2/oauth/tokens endpoint is deprecated; use POST /oauth/tokens as shown above.
  • Don't wait for April. The July 2026 cleanup already deactivated tokens that sat unused for 30 days. A quarterly report or a once-a-year script can lose its token long before the final shutdown.

A short checklist

  1. List every token in Admin Center and find what uses each one.
  2. Decide which admin account will own the OAuth clients.
  3. Create one confidential OAuth client per integration, with narrow scopes.
  4. Switch the code to get a token from /oauth/tokens and send it as a Bearer token, with expiry handled.
  5. Deactivate the old API token, watch for a day or two, then delete it.

Sources