Verify Identity

Sets the specified identity as verified. For security reasons, you can't use this endpoint to update the email identity of the account owner. To verify the person's identity, send a verification email. See [Verifying the account owner's email address](https://support.zendesk.com/hc/en-us/articles/4408828975130) in Zendesk help. #### Allowed For * Agents

Script zendesk Verified

by hugo697 ยท 11/7/2023

The script

Submitted by hugo697 Typescript (fetch-only)
Verified 377 days ago
1
type Zendesk = {
2
  username: string;
3
  password: string;
4
  subdomain: string;
5
};
6
/**
7
 * Verify Identity
8
 * Sets the specified identity as verified.
9

10
For security reasons, you can't use this endpoint to update the email identity of the account owner. To verify the person's identity, send a verification email. See [Verifying the account owner's email address](https://support.zendesk.com/hc/en-us/articles/4408828975130) in Zendesk help.
11

12
#### Allowed For
13

14
* Agents
15

16
 */
17
export async function main(
18
  auth: Zendesk,
19
  user_id: string,
20
  user_identity_id: string
21
) {
22
  const url = new URL(
23
    `https://${auth.subdomain}.zendesk.com/api/v2/users/${user_id}/identities/${user_identity_id}/verify`
24
  );
25

26
  const response = await fetch(url, {
27
    method: "PUT",
28
    headers: {
29
      Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
30
    },
31
    body: undefined,
32
  });
33
  if (!response.ok) {
34
    const text = await response.text();
35
    throw new Error(`${response.status} ${text}`);
36
  }
37
  return await response.json();
38
}
39