POST /oauth/tokens

Returns an OAuth access token in exchange for one of the following:

Note: The password grant type flow, which used a Zendesk username and password to get an access token, has been deprecated and is highly discouraged.

To revoke an access token, see Revoke Token.

Request parameters

The POST request takes the following parameters, which must be formatted as JSON:

NameDescription
grant_type"authorization_code", "refresh_token", or "client_credentials"
codeAuthorization grant flow only. The authorization code you received from Zendesk after the user granted access. The code is valid for only 120 seconds. See Handle the user's authorization decision in Zendesk help
client_idThe Identifier value specified in an OAuth client in the Zendesk Admin Center (Apps and integrations > APIs > OAuth clients). See Registering your application with Zendesk
client_secretThe Secret value specified in an OAuth client in the Admin Center (Apps and integrations > APIs > OAuth clients). See Registering your application with Zendesk
redirect_uriAuthorization grant flow only. The redirect URL you specified when you sent the user to the Zendesk authorization page. For ID purposes only. See Send the user to the Zendesk authorization page
scopeValid scope for this token. A space-separated string of scope values. Must be within the client's configured allowed scopes, if set. See Scope below
expires_inNumber of seconds the access token is valid. Must be greater than or equal to 300 seconds (5 minutes) and less than or equal to 172,800 seconds (2 days), or less than refresh_token_expires_in, whichever is the shorter. Defaults to null
refresh_token_expires_inNumber of seconds the refresh token is valid. Must be greater than or equal to 604,800 seconds (7 days) or expires_in (if given), and less than or equal to 7,776,000 seconds (90 days). Defaults to 2,592,000 seconds (30 days)
refresh_tokenA valid refresh token. See Replacing expired access tokens

Authorization code example

const tokenResponse = await axios.post(
  "https://{subdomain}.zendesk.com/oauth/tokens",
  {
    grant_type: "authorization_code",
    code: AUTHORIZATION_CODE,
    client_id: ZENDESK_CLIENT_ID,
    redirect_uri: REDIRECT_URI_PKCE,
    scope: "tickets:read users:read",
    code_verifier: CODE_VERIFIER,
    expires_in: 86400,
    refresh_token_expires_in: 604800,
  },
  { headers: { "Content-Type": "application/json" } }
);

Refresh token example

const tokenResponse = await axios.post(
  "https://{subdomain}.zendesk.com/oauth/tokens",
  {
    grant_type: "refresh_token",
    refresh_token: REFRESH_TOKEN,
    client_id: ZENDESK_CLIENT_ID,
    client_secret: ZENDESK_CLIENT_SECRET,
    scope: "tickets:write",
    expires_in: 86400,
    refresh_token_expires_in: 604800,
  },
  { headers: { "Content-Type": "application/json" } }
);

Client credentials example

const tokenResponse = await axios.post(
  "https://{subdomain}.zendesk.com/oauth/tokens",
  {
    grant_type: "client_credentials",
    client_id: ZENDESK_CLIENT_ID,
    client_secret: ZENDESK_CLIENT_SECRET,
    scope: "tickets:write",
    expires_in: 86400
  },
  { headers: { "Content-Type": "application/json" } }
);

Scope

You must specify a scope to control the app's access to Zendesk resources. The "read" scope gives access to GET endpoints and includes permission to sideload related resources. The "write" scope gives access to POST, PUT, and DELETE endpoints for creating, updating, and deleting resources.

Note: Don't confuse the scope parameter (singular) with the scopes parameter (plural) for non-grant-type tokens described in OAuth Tokens.

The "impersonate" scope allows a Zendesk admin to make requests on behalf of end users. See Making API requests on behalf of end users.

Broad scopes

The following parameter gives read access to all resources:

"scope": "read"

The following parameter gives read and write access to all resources:

"scope": "read write"

Resource-specific scopes

You can fine-tune access using resource-specific scopes. The syntax is as follows:

"scope": "resource:action"

For example, the following parameter restricts the scope to only reading tickets:

"scope": "tickets:read"

To give read and write access to a resource, specify both scopes:

"scope": "users:read users:write"

To give write access only to one resource, such as organizations, and read access to everything else:

"scope": "organizations:write read"

Scope errors

There are two distinct scope-related error cases to be aware of:

Available scopes

ScopeDescription
readRead all data. Gives access to GET endpoints, including permission to sideload related resources.
writeWrite all data. Gives access to POST, PUT, and DELETE endpoints.
impersonateAllows Zendesk Support admins to make requests on behalf of end users. See Making API requests on behalf of end users.
account_settings:readView account settings. Includes account configuration, ticket and user fields, and workspaces.
account_settings:writeCreate, edit, and delete account settings. Includes account configuration, ticket and user fields, and workspaces.
ai_agents:chatChat with AI agents. Includes sending messages and receiving responses via the Zendesk Developers API.
apps:readView installed apps and their settings. Includes which apps are installed and each app's settings.
apps:writeInstall, configure, and remove apps. Includes installing and uninstalling apps, changing settings, and uploading custom app packages.
auditlogs:readView audit logs. Includes the account-wide record of changes: who changed what and when. Read only.
automations:readView automations and their details.
automations:writeCreate, edit, and delete automations.
brands:readView brands and their agent assignments.
brands:writeCreate, edit, and delete brands and their agent assignments.
custom_objects:readView custom objects. Includes custom object definitions and record attachments.
custom_objects:writeCreate, edit, and delete custom objects. Includes definitions and record attachments.
deletion_schedules:readView deletion schedules. Includes data retention policies that automatically delete tickets, users, and other data.
deletion_schedules:writeDelete deletion schedules. Includes deleting data retention policies.
dynamic_content:readView dynamic content items and language variants.
dynamic_content:writeCreate, edit, and delete dynamic content items and language variants.
groups:readView groups and their memberships.
groups:writeCreate, edit, and delete groups and their memberships.
hc:readView Help Center content. Includes articles, sections, categories, community posts and comments.
hc:writeCreate, edit, and delete Help Center content. Includes articles, sections, categories, community posts and comments.
macros:readView macros, their categories, and attachments.
macros:writeCreate, edit, and delete macros and their attachments.
organizations:readView organizations and their details. Includes memberships, subscriptions, and merge history.
organizations:writeCreate, edit, and delete organizations and manage their memberships. Includes adding and removing users, managing subscriptions, and merging organizations.
requests:readView support requests and their comments.
requests:writeSubmit and edit support requests. Includes creating new requests and adding to existing ones.
satisfaction_ratings:readView satisfaction ratings, scores, and reasons.
satisfaction_ratings:writeSubmit satisfaction ratings. Includes rating a ticket good or bad with an optional reason.
security:readView security and sign-in settings. Includes password policy, session timeouts, IP restrictions, and SSO configuration. Read only.
sla_policies:readView SLA and group SLA policies.
sla_policies:writeCreate, edit, delete, and reorder SLA and group SLA policies.
targets:readView targets and their delivery failures.
targets:writeCreate, edit, and delete targets.
themes:readView Guide themes and their files.
themes:writeCreate, edit, and delete Guide themes. Includes importing, updating, publishing, exporting, and deleting themes.
ticket_attachments:readView files attached to tickets.
ticket_attachments:writeUpload, edit, and delete ticket attachments. Includes uploading files, updating and deleting attachments, and redacting them.
ticket_views:readView ticket views and the tickets they return.
ticket_views:writeCreate, edit, and delete ticket views.
tickets:readView tickets. Includes ticket contents, comments and conversation history, tags, forms and fields, audits, events, and metrics.
tickets:writeCreate, edit, and delete tickets. Includes adding comments, tags, merging tickets, marking spam, attachments, forms, and custom statuses.
triggers:readView triggers, trigger categories, and their revision history.
triggers:writeCreate, edit, delete, and reorder triggers and trigger categories.
users:readView users. Includes identities, active sessions, group, organization, and brand memberships, roles, and settings.
users:writeCreate, edit, and delete users and manage their access. Includes resetting passwords, ending sessions, adding identities, changing memberships, and managing custom roles.
webhooks:readView webhooks and their activity history.
webhooks:writeCreate, edit, test, and delete webhooks.
any_channel:writePush messages from an external channel into Zendesk. Includes creating tickets, comments, and users from an integrated channel. Write only.
web_widget:writeEdit Web Widget settings and configuration. Write only.
zis:readView private integrations. Includes configurations, connections, and inbound webhooks.
zis:writeCreate, edit, and delete private integrations. Includes configurations, connections, and inbound webhooks.

Servers

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.