0

Get work items in a queue

by
Published Oct 17, 2025

Retrieves a paginated list of work items. Any one of the following roles is required for this endpoint: |Legacy Role|Equivalent Permission Set Role| |-----|--------| |org.user.routing.read|org.permission.work_item.read| ||org.permission.routing.read|

Script kustomer Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Kustomer = {
3
  apiKey: string;
4
};
5
/**
6
 * Get work items in a queue
7
 * Retrieves a paginated list of work items.
8

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

11
|Legacy Role|Equivalent Permission Set Role|
12
|-----|--------|
13
|org.user.routing.read|org.permission.work_item.read|
14
||org.permission.routing.read|
15
 */
16
export async function main(auth: Kustomer, id: string) {
17
  const url = new URL(
18
    `https://api.kustomerapp.com/v1/routing/queues/${id}/work-items`,
19
  );
20

21
  const response = await fetch(url, {
22
    method: "GET",
23
    headers: {
24
      Authorization: "Bearer " + auth.apiKey,
25
    },
26
    body: undefined,
27
  });
28
  if (!response.ok) {
29
    const text = await response.text();
30
    throw new Error(`${response.status} ${text}`);
31
  }
32
  return await response.json();
33
}
34