> ## Documentation Index
> Fetch the complete documentation index at: https://klef.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Zendesk User Provisioning & Deprovisioning

> Automate Zendesk user provisioning and deprovisioning from your HRIS. Klef creates, updates, and deactivates accounts when HR makes a change.

![](https://mintcdn.com/klef/O1Sswmcb_uCGkmIf/images/connectors/zendesk.svg?fit=max\&auto=format\&n=O1Sswmcb_uCGkmIf\&q=85\&s=218bd7eaf483a55be41c0cd6282de6be)

# Zendesk

## Connection

### Setup

Make an OAuth client for Klef in Zendesk, signed in as an admin. Zendesk acts as whoever made the client, so it must be an admin.

**Step 1**

In Admin Center, go to **Apps and integrations**, then **APIs**, then **OAuth Clients**, and choose **Add OAuth client**.

**Step 2**

Set **Client kind** to **Confidential**, and allow the scopes `users:read`, `users:write`, `groups:read`, `groups:write`, `organizations:read`, and `organizations:write`.

**Step 3**

Save the client, then copy its **Identifier** and **Secret** into Klef, with your subdomain, the name before .zendesk.com.

Zendesk no longer issues API tokens, so Klef connects only through an OAuth client.

Klef manages agents and admins. It never lists end users, who are your customers. When a worker's email belongs to an end user, Klef gives that user the role the policy names.

Klef suspends a user it removes, which keeps their tickets. A user is deleted only when a policy sets **Deleted**. Custom roles need the Enterprise plan or higher.

### Settings

| Setting | Required | Description |
| - | - | - |
| Subdomain | Yes | The name before .zendesk.com in your Zendesk address. |
| Client ID | Yes | Identifier of the OAuth client you made for this connection. |
| Client secret | Yes | Secret of the OAuth client you made for this connection. |

## zendesk.user

### Fields

| Field | Type | Required | Description |
| - | - | - | - |
| `email` | string | Yes | Primary email address the user signs in with. The connector does not change it once the user exists. Never changed once the account exists. |
| `name` | string, up to 255 | Yes | Full name. |
| `role` | enum | | Role in the account. Defaults to agent. An end user that already exists at the email becomes this role. Values: `agent` (Agent), `admin` (Admin). |
| `customRole` | string | | Custom role ID, for an agent on the Enterprise plan or higher. |
| `groups` | entitlements | | Groups the user belongs to, which route tickets to them. One row grants one group. |
| `groups[]` | string | | Group ID. |
| `organizations` | entitlements | | Organizations the user belongs to. One row grants one organization. |
| `organizations[]` | string | | Organization ID. |
| `suspended` | bool | | Whether the user is suspended, which stops them signing in and keeps their tickets. This is how the connector removes a user. Shows the account's status: a policy reads it and sets `status` instead. |
| `deleted` | bool | | Whether to delete the user. Their tickets stay. |
| `status` | enum | | Whether the person can sign in, the account is kept switched off, or the account is gone. Values: `enabled` (Enabled), `disabled` (Disabled). |

### Default Account Matching Rules

When Klef [adopts](https://klef.ai/docs/adoption.md) an account that already exists in Zendesk, it works out whose it is by trying these in order. A connection can override them.

| Account field | Worker field |
| - | - |
| `email` | `worker.business_email` |

## Examples

### Zendesk agents

A Zendesk agent for everyone in support, suspended with their tickets kept when they leave.

```hcl theme={null}
stage active {
  target zendesk.user {
    email  = worker.business_email
    name   = worker.display_name
    role   = "agent"
    status = enabled
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.