@@ -11,6 +11,12 @@ The [Zendesk Support API](https://developer.zendesk.com/api-reference/ticketing/
### What are Zendesk API tokens
{{% alert title="Warning" color="warning" %}}
Zendesk API token use is [being deprecated](https://support.zendesk.com/hc/en-us/articles/10840968198042-Announcing-the-removal-of-API-tokens-as-an-authentication-method-for-API-requests) 2027-04-30.
{{% /alert %}}
Zendesk API tokens are used in authentication for Zendesk API requests. These tokens are always at the administrator level and cannot be issued at lower permission/role levels. As such, you should always use caution in using and issuing these tokens.
For information on grant types, please see [Zendesk documentation](https://developer.zendesk.com/api-reference/ticketing/oauth/grant_type_tokens/)
Do note we recommend using the [client_credentials](https://developer.zendesk.com/api-reference/ticketing/oauth/grant_type_tokens/#client-credentials-grant-type) grant type.
### Scope
For information on scope, please see [Zendesk documentation](https://developer.zendesk.com/api-reference/ticketing/oauth/grant_type_tokens/#scope)
## Using OAuth clients
The generalized process for using an OAuth client is:
- Generate a bearer token
- Perform your API actions
- Revoke the token
### Generating a bearer token
{{% alert title="Note" color="primary" %}}
- You can only generate these via the API or redirect URL flow. This focuses on using the API as the redirect URL flow can vary from setup to setup.
{{% /alert %}}
To generate a bearer token, you need to know the OAuth client's identifier and secret values. You would then make a POST request to the endpoint `oauth/tokens` with the needed payload.
The payload used should be in the format:
```json
{
"client_id":"CLIENT_IDENTIFIER",
"client_secret":"CLIENT_SECRET",
"grant_type":"client_credentials",
"scope":"SCOPE VALUES TO USE"
}
```
In the returned body, the `access_token` attribute is what you will use as the bearer token.
### Revoking a bearer token
#### Via the UI
To revoke a bearer token via the UI:
1. Navigate to the admin dashboard for the Zendesk instance
-[Zendesk Global (production)](https://gitlab.zendesk.com/admin/home)
-[Zendesk Global (sandbox)](https://gitlab1707170878.zendesk.com/admin/home)
-[Zendesk US Government (production)](https://gitlab-federal-support.zendesk.com/admin/home)
-[Zendesk US Government (sandbox)](https://gitlabfederalsupport1585318082.zendesk.com/admin/home)
1. Go to `Apps and integrations > APIs > OAuth clients`
-[Zendesk Global (sandbox)](https://gitlab1707170878.zendesk.com/admin/apps-integrations/apis/oauth-clients)
-[Zendesk US Government](https://gitlab-federal-support.zendesk.com/admin/apps-integrations/apis/oauth-clients)
-[Zendesk US Government (sandbox)](https://gitlabfederalsupport1585318082.zendesk.com/admin/apps-integrations/apis/oauth-clients)
1. Locate the OAuth client you want to revoke a bearer token for
1. Click the three vertical dots to the right of the OAuth client
1. Click `View tokens`
1. Locate the bearer token to revoke and click the three vertical dots to the right
1. Click `Delete`
1. Click `Delete` on the pop-up to confirm
#### Via the API
To revoke a bearer token via the API, you must know the bearer token's ID. You would then make a DELETE request to the endpoint `api/v2/oauth/tokens/:token_id` (replacing `:token_id` with the bearer token's ID).
In the normal process of generating a bearer token via the API, it is very likely you will not know the generated bearer token's ID. As such, you might need to use what you do know (the OAuth client's identifier and the bearer token itself) to get to that end.
As an example, here is what the process might look like for the OAuth client identifier `test123` with the bearer token `abcdefg123456789`: