0

Update routing user status

by
Published Oct 17, 2025

Updates a routing user status based on its unique ID. Any one of the following roles is required for this endpoint: |Legacy Role|Equivalent Permission Set Role| |-----|--------| |org.admin.routing.write|org.permission.routing_status.update| ||org.permission.routing.update|

Script kustomer Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Kustomer = {
3
  apiKey: string;
4
};
5
/**
6
 * Update routing user status
7
 * Updates a routing user status based on its unique ID.
8

9
Any one of the following roles is required for this endpoint:
10

11
|Legacy Role|Equivalent Permission Set Role|
12
|-----|--------|
13
|org.admin.routing.write|org.permission.routing_status.update|
14
||org.permission.routing.update|
15
 */
16
export async function main(
17
  auth: Kustomer,
18
  id: string,
19
  body: {
20
    name?: string;
21
    description?: string;
22
    externalId?: string;
23
    enabled?: false | true;
24
  },
25
) {
26
  const url = new URL(`https://api.kustomerapp.com/v1/routing/statuses/${id}`);
27

28
  const response = await fetch(url, {
29
    method: "PUT",
30
    headers: {
31
      "Content-Type": "application/json",
32
      Authorization: "Bearer " + auth.apiKey,
33
    },
34
    body: JSON.stringify(body),
35
  });
36
  if (!response.ok) {
37
    const text = await response.text();
38
    throw new Error(`${response.status} ${text}`);
39
  }
40
  return await response.json();
41
}
42