0

Get Tasks

by
Published Oct 17, 2025

View the tasks in a List. Responses are limited to 100 tasks per page. You can only view task information of tasks you can access. \ \ This endpoint only includes tasks where the specified `list_id` is their home List. Tasks added to the `list_id` with a different home List are not included in the response.

Script clickup Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Clickup = {
3
  token: string;
4
};
5
/**
6
 * Get Tasks
7
 * View the tasks in a List. Responses are limited to 100 tasks per page. You can only view task information of tasks you can access. \
8
 \
9
This endpoint only includes tasks where the specified `list_id` is their home List. Tasks added to the `list_id` with a different home List are not included in the response.
10
 */
11
export async function main(
12
  auth: Clickup,
13
  list_id: string,
14
  archived: string | undefined,
15
  include_markdown_description: string | undefined,
16
  page: string | undefined,
17
  order_by: string | undefined,
18
  reverse: string | undefined,
19
  subtasks: string | undefined,
20
  statuses: string | undefined,
21
  include_closed: string | undefined,
22
  assignees: string | undefined,
23
  watchers: string | undefined,
24
  tags: string | undefined,
25
  due_date_gt: string | undefined,
26
  due_date_lt: string | undefined,
27
  date_created_gt: string | undefined,
28
  date_created_lt: string | undefined,
29
  date_updated_gt: string | undefined,
30
  date_updated_lt: string | undefined,
31
  date_done_gt: string | undefined,
32
  date_done_lt: string | undefined,
33
  custom_fields: string | undefined,
34
  custom_field: string | undefined,
35
  custom_items: string | undefined,
36
) {
37
  const url = new URL(`https://api.clickup.com/api/v2/list/${list_id}/task`);
38
  for (const [k, v] of [
39
    ["archived", archived],
40
    ["include_markdown_description", include_markdown_description],
41
    ["page", page],
42
    ["order_by", order_by],
43
    ["reverse", reverse],
44
    ["subtasks", subtasks],
45
    ["statuses", statuses],
46
    ["include_closed", include_closed],
47
    ["assignees", assignees],
48
    ["watchers", watchers],
49
    ["tags", tags],
50
    ["due_date_gt", due_date_gt],
51
    ["due_date_lt", due_date_lt],
52
    ["date_created_gt", date_created_gt],
53
    ["date_created_lt", date_created_lt],
54
    ["date_updated_gt", date_updated_gt],
55
    ["date_updated_lt", date_updated_lt],
56
    ["date_done_gt", date_done_gt],
57
    ["date_done_lt", date_done_lt],
58
    ["custom_fields", custom_fields],
59
    ["custom_field", custom_field],
60
    ["custom_items", custom_items],
61
  ]) {
62
    if (v !== undefined && v !== "" && k !== undefined) {
63
      url.searchParams.append(k, v);
64
    }
65
  }
66
  const response = await fetch(url, {
67
    method: "GET",
68
    headers: {
69
      Authorization: auth.token,
70
    },
71
    body: undefined,
72
  });
73
  if (!response.ok) {
74
    const text = await response.text();
75
    throw new Error(`${response.status} ${text}`);
76
  }
77
  return await response.json();
78
}
79