0

List All Automation Rules

by
Published Oct 17, 2025

Returns all automation rules associated with the specified sheet. Multistep workflows are not returned via the API. Instead, you'll see an error 400 - 1266: This rule is not accessible through the API. Only single-action notifications, approval requests, or update requests qualify. For users of Smartsheet for Slack, note that Slack notifications are not returned.

Script smartsheet Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Smartsheet = {
3
  token: string;
4
  baseUrl: string;
5
};
6
/**
7
 * List All Automation Rules
8
 * Returns all automation rules associated with the specified sheet.
9

10
Multistep workflows are not returned via the API.
11
Instead, you'll see an error 400 - 1266: This rule is not accessible through the API.
12
Only single-action notifications, approval requests, or update requests qualify.
13

14
For users of Smartsheet for Slack, note that Slack notifications are not returned.
15

16
 */
17
export async function main(
18
  auth: Smartsheet,
19
  sheetId: string,
20
  includeAll: string | undefined,
21
  page: string | undefined,
22
  pageSize: string | undefined,
23
) {
24
  const url = new URL(
25
    `${auth.baseUrl}/sheets/${sheetId}/automationrules`,
26
  );
27
  for (const [k, v] of [
28
    ["includeAll", includeAll],
29
    ["page", page],
30
    ["pageSize", pageSize],
31
  ]) {
32
    if (v !== undefined && v !== "" && k !== undefined) {
33
      url.searchParams.append(k, v);
34
    }
35
  }
36
  const response = await fetch(url, {
37
    method: "GET",
38
    headers: {
39
      Authorization: "Bearer " + auth.token,
40
    },
41
    body: undefined,
42
  });
43
  if (!response.ok) {
44
    const text = await response.text();
45
    throw new Error(`${response.status} ${text}`);
46
  }
47
  return await response.json();
48
}
49