@zapier/zapier-sdk 0.116.2 → 0.117.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,7 +29,19 @@
29
29
  - [`createClientCredentials`](#createclientcredentials)
30
30
  - [`deleteClientCredentials`](#deleteclientcredentials)
31
31
  - [`listClientCredentials`](#listclientcredentials)
32
- - [Code Workflows (Experimental)](#code-workflows-experimental)
32
+ - [Connections](#connections)
33
+ - [`createConnection`](#createconnection)
34
+ - [`findFirstConnection`](#findfirstconnection)
35
+ - [`findUniqueConnection`](#finduniqueconnection)
36
+ - [`getConnection`](#getconnection)
37
+ - [`getConnectionStartUrl`](#getconnectionstarturl)
38
+ - [`listConnections`](#listconnections)
39
+ - [`waitForNewConnection`](#waitfornewconnection)
40
+ - [HTTP Requests](#http-requests)
41
+ - [`fetch`](#fetch)
42
+ - [Human Inputs (Experimental)](#human-inputs-experimental)
43
+ - [`createForm`](#createform--experimental)
44
+ - [Next Gen Zaps (Experimental)](#next-gen-zaps-experimental)
33
45
  - [`cancelDurableRun`](#canceldurablerun--experimental)
34
46
  - [`createWorkflow`](#createworkflow--experimental)
35
47
  - [`createWorkflowDraft`](#createworkflowdraft--experimental)
@@ -63,18 +75,6 @@
63
75
  - [`updateWorkflow`](#updateworkflow--experimental)
64
76
  - [`updateWorkflowDraft`](#updateworkflowdraft--experimental)
65
77
  - [`validateWorkflow`](#validateworkflow--experimental)
66
- - [Connections](#connections)
67
- - [`createConnection`](#createconnection)
68
- - [`findFirstConnection`](#findfirstconnection)
69
- - [`findUniqueConnection`](#finduniqueconnection)
70
- - [`getConnection`](#getconnection)
71
- - [`getConnectionStartUrl`](#getconnectionstarturl)
72
- - [`listConnections`](#listconnections)
73
- - [`waitForNewConnection`](#waitfornewconnection)
74
- - [HTTP Requests](#http-requests)
75
- - [`fetch`](#fetch)
76
- - [Human Inputs (Experimental)](#human-inputs-experimental)
77
- - [`createForm`](#createform--experimental)
78
78
  - [Tables](#tables)
79
79
  - [`createTable`](#createtable)
80
80
  - [`createTableFields`](#createtablefields)
@@ -484,6 +484,8 @@ await zapier.apps.slack.read.channels({
484
484
 
485
485
  ### Accounts
486
486
 
487
+ Your Zapier user account, the one the SDK is signed in as. Use these to check who that is.
488
+
487
489
  #### `getProfile`
488
490
 
489
491
  Get current user's profile information
@@ -515,6 +517,8 @@ const { data: profile } = await zapier.getProfile();
515
517
 
516
518
  ### Actions
517
519
 
520
+ An action is something an app can do, like sending an email or creating a contact. Use these to find an app's actions, see what inputs they need, and run them directly, outside a Zap.
521
+
518
522
  #### `createActionRun`
519
523
 
520
524
  Start an action run and return its ID without waiting for the result. Running an action is asynchronous: this hands back a run ID immediately, and `getActionRun` fetches the outcome. Reach for this pair when you want to start work and collect it later (fan out many runs, hand the ID to another process, survive a restart). `runAction` is the one-call form that starts a run and waits for its result.
@@ -928,6 +932,8 @@ for await (const actionResult of zapier
928
932
 
929
933
  ### Apps
930
934
 
935
+ An app is a web service that connects with Zapier, like Gmail or Slack. Use these to find apps and the keys other methods use to refer to them.
936
+
931
937
  #### `apps.{appKey}`
932
938
 
933
939
  Bind a connection alias or numeric connectionId to an app
@@ -1144,6 +1150,8 @@ for await (const app of zapier.listApps().items()) {
1144
1150
 
1145
1151
  ### Client Credentials
1146
1152
 
1153
+ SDK client credentials are a client ID and client secret that authenticate your code to the Zapier SDK, separate from the connections that authenticate apps. Use these to create, list, and revoke them.
1154
+
1147
1155
  #### `createClientCredentials`
1148
1156
 
1149
1157
  Create new client credentials for the authenticated user
@@ -1237,362 +1245,487 @@ for await (const clientCredentials of zapier.listClientCredentials().items()) {
1237
1245
  }
1238
1246
  ```
1239
1247
 
1240
- ### Code Workflows (Experimental)
1241
-
1242
- > ℹ️ **Experimental.** Still being designed; may change shape or disappear in any release, without notice. Import from `"@zapier/zapier-sdk/experimental"` to use these methods.
1243
-
1244
- #### `cancelDurableRun` 🧪 _experimental_
1245
-
1246
- Cancel a run-once durable run in initialized or started status. Returns 409 if the run is already terminal.
1247
-
1248
- **Parameters:**
1249
-
1250
- | Name | Type | Required | Default | Possible Values | Description |
1251
- | --------- | -------- | -------- | ------- | --------------- | -------------- |
1252
- | `options` | `object` | ✅ | — | — | |
1253
- | ​ ↳ `run` | `string` | ✅ | — | — | Durable run ID |
1254
-
1255
- **Returns:** `Promise<DurableRunItem>`
1256
-
1257
- | Name | Type | Required | Possible Values | Description |
1258
- | ------------ | -------- | -------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1259
- | `data` | `object` | ✅ | — | |
1260
- | ​ ↳ `id` | `string` | ✅ | — | Run ID that was targeted |
1261
- | ​ ↳ `status` | `string` | ✅ | `cancelled` | Always `cancelled` on a successful call. Synthesized client-side — the backend returns 204; callers needing the run's full state should follow up with getDurableRun. |
1248
+ ### Connections
1262
1249
 
1263
- **Example:**
1250
+ A connection is an authenticated link between Zapier and your account in an app, like your company's Slack workspace, made with OAuth or an API key. Use these to find existing connections or create new ones for actions, triggers, and API requests to use.
1264
1251
 
1265
- ```typescript
1266
- const { data: durableRun } = await zapier.cancelDurableRun({
1267
- run: "example-run",
1268
- });
1269
- ```
1252
+ #### `createConnection`
1270
1253
 
1271
- #### `createWorkflow` 🧪 _experimental_
1254
+ Create a new app connection, end-to-end. Mints the start URL via `get-connection-start-url`, prints it to stderr, opportunistically opens it in a browser when it looks safe to do so (skipping CI / SSH / headless-Linux by default — pass `--browser always` to force, `--browser never` to suppress), then polls via `wait-for-new-connection` until the user completes OAuth and the new connection appears. Returns the connection.
1272
1255
 
1273
- Create a durable workflow container. Starts disabled with no version; publish a version to add code.
1256
+ This is the right command for most callers. Reach for the lower-level building blocks when you want either of: (a) hand off the URL and _not_ block on completion — call `get-connection-start-url` alone, no `wait-for-new-connection` needed, or (b) do something custom between minting the URL and waiting — call `get-connection-start-url`, do your work (email or DM the URL, render a QR code, etc.), then `wait-for-new-connection`.
1274
1257
 
1275
1258
  **Parameters:**
1276
1259
 
1277
- | Name | Type | Required | Default | Possible Values | Description |
1278
- | ----------------- | --------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------- |
1279
- | `options` | `object` | ✅ | — | — | |
1280
- | ​ ↳ `name` | `string` | ✅ | — | — | Workflow name |
1281
- | ​ ↳ `description` | `string` | ❌ | — | — | Optional description for the workflow |
1282
- | ​ ↳ `private` | `boolean` | ❌ | — | — | If true, only the creating user can see or manage this workflow. Defaults to false (account-visible). |
1260
+ | Name | Type | Required | Default | Possible Values | Description |
1261
+ | ------------------------------ | -------- | -------- | -------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1262
+ | `options` | `object` | ✅ | — | — | |
1263
+ | ​ ↳ `app` | `string` | ✅ | — | — | App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3') |
1264
+ | ​ ↳ `browser` | `string` | ❌ | `"auto"` | `auto`, `always`, `never` | When to auto-open the URL in a browser. `auto` (default) opens in local sessions and skips opening in CI / SSH / headless-Linux. `always` forces the open attempt. `never` skips it. The URL is always printed to stderr regardless — a failed or skipped open degrades gracefully to copy-paste. |
1265
+ | ​ ↳ `timeoutSeconds` | `number` | ❌ | — | — | How long to wait for the user to complete the connection flow before giving up. Default 5 minutes (300). |
1266
+ | ​ ↳ `pollIntervalMilliseconds` | `number` | ❌ | — | — | Delay before the first poll request, in ms. Default 3 seconds (3_000). Subsequent polling cadence is managed by the SDK's polling primitive (backoff with sane defaults). |
1283
1267
 
1284
- **Returns:** `Promise<WorkflowItem>`
1268
+ **Returns:** `Promise<ConnectionItem>`
1285
1269
 
1286
- | Name | Type | Required | Possible Values | Description |
1287
- | ------------------------ | --------- | -------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1288
- | `data` | `object` | ✅ | — | |
1289
- | ​ ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
1290
- | ​ ↳ `name` | `string` | ✅ | — | Workflow name |
1291
- | ​ ↳ `description` | `string` | ✅ | — | Workflow description (null if unset) |
1292
- | ​ ↳ `trigger_url` | `string` | ✅ | — | Public URL that fires this workflow when POSTed to. Embeds a trigger token in the path — treat as sensitive. Requests must also be authenticated as the account. |
1293
- | ​ ↳ `editor_url` | `string` | ✅ | — | URL to the Zapier workflow editor for this workflow |
1294
- | ​ ↳ `enabled` | `boolean` | ✅ | — | Whether the workflow currently accepts triggers. Always false on a new workflow until enabled. |
1295
- | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the workflow is private to the creating user. False means account-visible. |
1296
- | ​ ↳ `created_by_user_id` | `string` | ✅ | — | User ID of the workflow creator (null in legacy data) |
1297
- | ​ ↳ `created_at` | `string` | ✅ | — | When the workflow was created (ISO-8601) |
1270
+ | Name | Type | Required | Possible Values | Description |
1271
+ | ----------- | -------- | -------- | --------------- | ------------------------------------------------------------------------------------ |
1272
+ | `data` | `object` | ✅ | — | |
1273
+ | ​ ↳ `id` | `string` | ✅ | — | The new connection's ID. Public UUID when available, falling back to the numeric ID. |
1274
+ | ​ ↳ `app` | `string` | ✅ | — | Versionless app key the connection was created for (e.g., 'SlackCLIAPI'). |
1275
+ | ​ ↳ `title` | `string` | ❌ | — | Human-readable connection title set by the auth flow, when available. |
1298
1276
 
1299
1277
  **Example:**
1300
1278
 
1301
1279
  ```typescript
1302
- const { data: workflow } = await zapier.createWorkflow({
1303
- name: "example-name",
1280
+ const { data: connection } = await zapier.createConnection({
1281
+ app: "example-app",
1304
1282
  });
1305
1283
  ```
1306
1284
 
1307
- #### `createWorkflowDraft` 🧪 _experimental_
1285
+ #### `findFirstConnection`
1308
1286
 
1309
- Fork a new draft from the workflow's current live version (or a blank stub before the first publish)
1287
+ Find the first connection matching the criteria
1310
1288
 
1311
1289
  **Parameters:**
1312
1290
 
1313
- | Name | Type | Required | Default | Possible Values | Description |
1314
- | -------------- | -------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
1315
- | `options` | `object` | ✅ | — | — | |
1316
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1317
- | ​ ↳ `slug` | `string` | ❌ | — | — | Optional display name for the draft. When omitted, the server generates one. Need not be unique among the workflow's open drafts. |
1291
+ | Name | Type | Required | Default | Possible Values | Description |
1292
+ | ------------------- | --------- | -------- | ------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
1293
+ | `options` | `object` | ✅ | — | — | |
1294
+ | ​ ↳ `search` | `string` | ❌ | — | — | Search term to filter connections by title |
1295
+ | ​ ↳ `title` | `string` | ❌ | — | — | Filter connections by exact title match (searches first, then filters locally) |
1296
+ | ​ ↳ `owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own connections or a specific user ID |
1297
+ | ​ ↳ `app` | `string` | ❌ | — | — | App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github') |
1298
+ | ​ ↳ `account` | `string` | ❌ | — | — | Account to filter by |
1299
+ | ​ ↳ `includeShared` | `boolean` | ❌ | — | — | Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections. |
1300
+ | ​ ↳ `status` | `string` | ❌ | — | `active`, `expired`, `all` | Filter connections by expiry: 'active' (default) returns only non-expired connections, 'expired' only expired ones, and 'all' returns both. |
1318
1301
 
1319
- **Returns:** `Promise<WorkflowDraftItem>`
1302
+ **Returns:** `Promise<ConnectionItem>`
1320
1303
 
1321
- | Name | Type | Required | Possible Values | Description |
1322
- | ---------------------------- | -------- | -------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
1323
- | `data` | `object` | ✅ | — | |
1324
- | ​ ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
1325
- | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
1326
- | ​ ↳ `slug` | `string` | ✅ | — | Human-friendly display name, not an identifier: two open drafts of a workflow may share one |
1327
- | ​ ↳ `base_version_id` | `string` | ✅ | — | The version this draft was forked from (the live version at draft creation), or null when the workflow had no published version yet |
1328
- | ​ ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
1329
- | ​ ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this draft |
1330
- | ​ ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this draft (or null) |
1331
- | ​ ↳ `draft_revision` | `number` | ✅ | — | Monotonic revision counter for optimistic concurrency. Echo it back on draft updates to detect concurrent edits. |
1332
- | ​ ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
1333
- | ​ ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who created (forked) this draft |
1334
- | ​ ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
1335
- | ​ ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
1336
- | ​ ↳ `discarded_at` | `string` | ✅ | — | When the draft was discarded (ISO-8601), or null while open |
1337
- | ​ ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
1338
- | ​ ↳ `updated_at` | `string` | ✅ | — | When the draft row was last updated (ISO-8601) |
1339
- | ​ ↳ `trigger` | `object` | ✅ | — | Trigger configuration held on this draft, or null for webhook-only workflows. |
1340
- | ​ ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this draft (or null). |
1341
- | ​ ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this draft (or null). |
1304
+ | Name | Type | Required | Possible Values | Description |
1305
+ | ------------------------------ | --------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
1306
+ | `data` | `object` | ✅ | — | |
1307
+ | ​ ↳ `id` | `string` | ✅ | — | Unique identifier for the connection |
1308
+ | ​ ↳ `date` | `string` | ✅ | — | Date created |
1309
+ | ​ ↳ `lastchanged` | `string` | ❌ | — | Date last changed |
1310
+ | ​ ↳ `account_id` | `string` | ✅ | — | Account ID associated with this connection |
1311
+ | ​ ↳ `slug` | `string` | ❌ | — | Human-readable app slug for this connection's integration (e.g. 'google-sheets'). Null when no slug is registered for the app. |
1312
+ | ​ ↳ `destination_selected_api` | `string` | ❌ | — | Destination API key (if applicable) |
1313
+ | ​ ↳ `is_invite_only` | `boolean` | ✅ | — | Whether the connection is invite-only |
1314
+ | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the connection is private |
1315
+ | ​ ↳ `shared_with_all` | `boolean` | ✅ | — | Whether the connection is shared with all users |
1316
+ | ​ ↳ `is_stale` | `string` | ❌ | — | Stale status string |
1317
+ | ​ ↳ `is_shared` | `string` | ❌ | — | Shared status string |
1318
+ | ​ ↳ `marked_stale_at` | `string` | ❌ | — | Date when marked stale |
1319
+ | ​ ↳ `label` | `string` | ❌ | — | User label for the connection |
1320
+ | ​ ↳ `identifier` | `string` | ❌ | — | Identifier |
1321
+ | ​ ↳ `title` | `string` | ❌ | — | Title of the connection |
1322
+ | ​ ↳ `url` | `string` | ❌ | — | URL to the connection resource |
1323
+ | ​ ↳ `groups` | `array` | ❌ | — | Array of groups associated with the connection |
1324
+ | ​ ↳ `members` | `string` | ❌ | — | Members associated with the connection |
1325
+ | ​ ↳ `permissions` | `object` | ❌ | — | Permissions for the connection |
1326
+ | ​ ↳ `public_id` | `string` | ❌ | — | Public UUID for the connection |
1327
+ | ​ ↳ `account_public_id` | `string` | ❌ | — | Public UUID for the associated account |
1328
+ | ​ ↳ `customuser_public_id` | `string` | ❌ | — | Public UUID for the associated custom user |
1329
+ | ​ ↳ `implementation_id` | `string` | ❌ | — | Implementation ID (was selected_api) |
1330
+ | ​ ↳ `profile_id` | `string` | ❌ | — | Profile ID (was customuser_id) |
1331
+ | ​ ↳ `is_expired` | `string` | ❌ | — | Whether the connection is expired (mapped from is_stale) |
1332
+ | ​ ↳ `expired_at` | `string` | ❌ | — | Date when connection expired (mapped from marked_stale_at) |
1333
+ | ​ ↳ `app_key` | `string` | ❌ | — | App Key extracted from implementation_id |
1334
+ | ​ ↳ `app_version` | `string` | ❌ | — | App Version extracted from implementation_id |
1335
+ | ​ ↳ `is_managed` | `boolean` | ❌ | — | Whether this connection is managed by account admins (no individual owner) |
1342
1336
 
1343
1337
  **Example:**
1344
1338
 
1345
1339
  ```typescript
1346
- const { data: workflowDraft } = await zapier.createWorkflowDraft({
1347
- workflow: "example-workflow",
1348
- });
1340
+ const { data: connection } = await zapier.findFirstConnection();
1349
1341
  ```
1350
1342
 
1351
- #### `deleteWorkflow` 🧪 _experimental_
1343
+ #### `findUniqueConnection`
1352
1344
 
1353
- Delete a durable workflow. Throws `ZapierNotFoundError` if the workflow doesn't exist; callers wanting idempotency should catch that themselves.
1345
+ Find a unique connection matching the criteria
1354
1346
 
1355
1347
  **Parameters:**
1356
1348
 
1357
- | Name | Type | Required | Default | Possible Values | Description |
1358
- | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
1359
- | `options` | `object` | ✅ | — | — | |
1360
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1349
+ | Name | Type | Required | Default | Possible Values | Description |
1350
+ | ------------------- | --------- | -------- | ------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
1351
+ | `options` | `object` | ✅ | — | — | |
1352
+ | ​ ↳ `search` | `string` | ❌ | — | — | Search term to filter connections by title |
1353
+ | ​ ↳ `title` | `string` | ❌ | — | — | Filter connections by exact title match (searches first, then filters locally) |
1354
+ | ​ ↳ `owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own connections or a specific user ID |
1355
+ | ​ ↳ `app` | `string` | ❌ | — | — | App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github') |
1356
+ | ​ ↳ `account` | `string` | ❌ | — | — | Account to filter by |
1357
+ | ​ ↳ `includeShared` | `boolean` | ❌ | — | — | Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections. |
1358
+ | ​ ↳ `status` | `string` | ❌ | — | `active`, `expired`, `all` | Filter connections by expiry: 'active' (default) returns only non-expired connections, 'expired' only expired ones, and 'all' returns both. |
1361
1359
 
1362
- **Returns:** `Promise<{ success: boolean }>`
1360
+ **Returns:** `Promise<ConnectionItem>`
1363
1361
 
1364
- | Name | Type | Required | Possible Values | Description |
1365
- | -------- | -------- | -------- | --------------- | ------------------------------------------ |
1366
- | `data` | `object` | ✅ | — | |
1367
- | ​ ↳ `id` | `string` | ✅ | — | Workflow ID that was targeted for deletion |
1362
+ | Name | Type | Required | Possible Values | Description |
1363
+ | ------------------------------ | --------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
1364
+ | `data` | `object` | ✅ | — | |
1365
+ | ​ ↳ `id` | `string` | ✅ | — | Unique identifier for the connection |
1366
+ | ​ ↳ `date` | `string` | ✅ | — | Date created |
1367
+ | ​ ↳ `lastchanged` | `string` | ❌ | — | Date last changed |
1368
+ | ​ ↳ `account_id` | `string` | ✅ | — | Account ID associated with this connection |
1369
+ | ​ ↳ `slug` | `string` | ❌ | — | Human-readable app slug for this connection's integration (e.g. 'google-sheets'). Null when no slug is registered for the app. |
1370
+ | ​ ↳ `destination_selected_api` | `string` | ❌ | — | Destination API key (if applicable) |
1371
+ | ​ ↳ `is_invite_only` | `boolean` | ✅ | — | Whether the connection is invite-only |
1372
+ | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the connection is private |
1373
+ | ​ ↳ `shared_with_all` | `boolean` | ✅ | — | Whether the connection is shared with all users |
1374
+ | ​ ↳ `is_stale` | `string` | ❌ | — | Stale status string |
1375
+ | ​ ↳ `is_shared` | `string` | ❌ | — | Shared status string |
1376
+ | ​ ↳ `marked_stale_at` | `string` | ❌ | — | Date when marked stale |
1377
+ | ​ ↳ `label` | `string` | ❌ | — | User label for the connection |
1378
+ | ​ ↳ `identifier` | `string` | ❌ | — | Identifier |
1379
+ | ​ ↳ `title` | `string` | ❌ | — | Title of the connection |
1380
+ | ​ ↳ `url` | `string` | ❌ | — | URL to the connection resource |
1381
+ | ​ ↳ `groups` | `array` | ❌ | — | Array of groups associated with the connection |
1382
+ | ​ ↳ `members` | `string` | ❌ | — | Members associated with the connection |
1383
+ | ​ ↳ `permissions` | `object` | ❌ | — | Permissions for the connection |
1384
+ | ​ ↳ `public_id` | `string` | ❌ | — | Public UUID for the connection |
1385
+ | ​ ↳ `account_public_id` | `string` | ❌ | — | Public UUID for the associated account |
1386
+ | ​ ↳ `customuser_public_id` | `string` | ❌ | — | Public UUID for the associated custom user |
1387
+ | ​ ↳ `implementation_id` | `string` | ❌ | — | Implementation ID (was selected_api) |
1388
+ | ​ ↳ `profile_id` | `string` | ❌ | — | Profile ID (was customuser_id) |
1389
+ | ​ ↳ `is_expired` | `string` | ❌ | — | Whether the connection is expired (mapped from is_stale) |
1390
+ | ​ ↳ `expired_at` | `string` | ❌ | — | Date when connection expired (mapped from marked_stale_at) |
1391
+ | ​ ↳ `app_key` | `string` | ❌ | — | App Key extracted from implementation_id |
1392
+ | ​ ↳ `app_version` | `string` | ❌ | — | App Version extracted from implementation_id |
1393
+ | ​ ↳ `is_managed` | `boolean` | ❌ | — | Whether this connection is managed by account admins (no individual owner) |
1368
1394
 
1369
1395
  **Example:**
1370
1396
 
1371
1397
  ```typescript
1372
- const result = await zapier.deleteWorkflow({
1373
- workflow: "example-workflow",
1374
- });
1398
+ const { data: connection } = await zapier.findUniqueConnection();
1375
1399
  ```
1376
1400
 
1377
- #### `disableAgenticManagement` 🧪 _experimental_
1401
+ #### `getConnection`
1378
1402
 
1379
- Stop Agentic Management from working on one workflow. Its settings are kept, not deleted: the modes and auto-approve choice stay on file, so calling enableAgenticManagement later resumes with those settings instead of the defaults.
1403
+ Get details for a specific connection
1380
1404
 
1381
1405
  **Parameters:**
1382
1406
 
1383
- | Name | Type | Required | Default | Possible Values | Description |
1384
- | -------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------- |
1385
- | `options` | `object` | ✅ | — | — | |
1386
- | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to take out of agentic management. |
1387
-
1388
- **Returns:** `Promise<{ success: boolean }>`
1407
+ | Name | Type | Required | Default | Possible Values | Description |
1408
+ | ---------------- | ---------------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1409
+ | `options` | `object` | ✅ | — | — | |
1410
+ | ​ ↳ `connection` | `string, number` | ✅ | — | — | Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. |
1389
1411
 
1390
- | Name | Type | Required | Possible Values | Description |
1391
- | -------- | --------- | -------- | --------------- | -------------------------------------------------------------------- |
1392
- | `data` | `object` | ✅ | — | |
1393
- | ​ ↳ `ok` | `boolean` | ✅ | — | True when Zapier accepted the request to stop managing the workflow. |
1412
+ **Returns:** `Promise<ConnectionItem>`
1394
1413
 
1395
- **Example:**
1414
+ | Name | Type | Required | Possible Values | Description |
1415
+ | ------------------------------ | --------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
1416
+ | `data` | `object` | ✅ | — | |
1417
+ | ​ ↳ `id` | `string` | ✅ | — | Unique identifier for the connection |
1418
+ | ​ ↳ `date` | `string` | ✅ | — | Date created |
1419
+ | ​ ↳ `lastchanged` | `string` | ❌ | — | Date last changed |
1420
+ | ​ ↳ `account_id` | `string` | ✅ | — | Account ID associated with this connection |
1421
+ | ​ ↳ `slug` | `string` | ❌ | — | Human-readable app slug for this connection's integration (e.g. 'google-sheets'). Null when no slug is registered for the app. |
1422
+ | ​ ↳ `destination_selected_api` | `string` | ❌ | — | Destination API key (if applicable) |
1423
+ | ​ ↳ `is_invite_only` | `boolean` | ✅ | — | Whether the connection is invite-only |
1424
+ | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the connection is private |
1425
+ | ​ ↳ `shared_with_all` | `boolean` | ✅ | — | Whether the connection is shared with all users |
1426
+ | ​ ↳ `is_stale` | `string` | ❌ | — | Stale status string |
1427
+ | ​ ↳ `is_shared` | `string` | ❌ | — | Shared status string |
1428
+ | ​ ↳ `marked_stale_at` | `string` | ❌ | — | Date when marked stale |
1429
+ | ​ ↳ `label` | `string` | ❌ | — | User label for the connection |
1430
+ | ​ ↳ `identifier` | `string` | ❌ | — | Identifier |
1431
+ | ​ ↳ `title` | `string` | ❌ | — | Title of the connection |
1432
+ | ​ ↳ `url` | `string` | ❌ | — | URL to the connection resource |
1433
+ | ​ ↳ `groups` | `array` | ❌ | — | Array of groups associated with the connection |
1434
+ | ​ ↳ `members` | `string` | ❌ | — | Members associated with the connection |
1435
+ | ​ ↳ `permissions` | `object` | ❌ | — | Permissions for the connection |
1436
+ | ​ ↳ `public_id` | `string` | ❌ | — | Public UUID for the connection |
1437
+ | ​ ↳ `account_public_id` | `string` | ❌ | — | Public UUID for the associated account |
1438
+ | ​ ↳ `customuser_public_id` | `string` | ❌ | — | Public UUID for the associated custom user |
1439
+ | ​ ↳ `implementation_id` | `string` | ❌ | — | Implementation ID (was selected_api) |
1440
+ | ​ ↳ `profile_id` | `string` | ❌ | — | Profile ID (was customuser_id) |
1441
+ | ​ ↳ `is_expired` | `string` | ❌ | — | Whether the connection is expired (mapped from is_stale) |
1442
+ | ​ ↳ `expired_at` | `string` | ❌ | — | Date when connection expired (mapped from marked_stale_at) |
1443
+ | ​ ↳ `app_key` | `string` | ❌ | — | App Key extracted from implementation_id |
1444
+ | ​ ↳ `app_version` | `string` | ❌ | — | App Version extracted from implementation_id |
1445
+ | ​ ↳ `is_managed` | `boolean` | ❌ | — | Whether this connection is managed by account admins (no individual owner) |
1446
+
1447
+ **Example:**
1396
1448
 
1397
1449
  ```typescript
1398
- const result = await zapier.disableAgenticManagement({
1399
- workflow: "example-workflow",
1450
+ const { data: connection } = await zapier.getConnection({
1451
+ connection: "example-connection",
1400
1452
  });
1401
1453
  ```
1402
1454
 
1403
- #### `disableWorkflow` 🧪 _experimental_
1455
+ #### `getConnectionStartUrl`
1404
1456
 
1405
- Disable a durable workflow so it stops accepting triggers
1457
+ Mint a short-lived URL that begins an SDK-initiated connection flow. The URL is signed by zapier.com and bound to the current user/account — opening it in a different browser session will fail the binding check. Returns the URL as data so the caller decides what to do with it.
1458
+
1459
+ Use this directly (rather than the higher-level `create-connection`) when you want either of: (a) hand off the URL and _not_ block waiting for completion — call this alone, skip `wait-for-new-connection` entirely, or (b) do something custom between minting the URL and waiting for the connection — call this, then email or DM the URL, render it as a QR code for mobile sign-in, etc., then call `wait-for-new-connection`. For the common case where you'd just print and poll back-to-back, `create-connection` is one call.
1460
+
1461
+ Pair with `wait-for-new-connection` to detect completion: pass the `startedAt` returned here straight through (it's the server's mint time, so polling isn't affected by client clock skew). Example (JS):
1462
+
1463
+ ```ts
1464
+ const {
1465
+ data: { url, app, startedAt },
1466
+ } = await zapier.getConnectionStartUrl({ app: "slack" });
1467
+ // hand `url` off — print it, DM it, email it, render a button, whatever
1468
+ const { data: conn } = await zapier.waitForNewConnection({ app, startedAt });
1469
+ ```
1406
1470
 
1407
1471
  **Parameters:**
1408
1472
 
1409
- | Name | Type | Required | Default | Possible Values | Description |
1410
- | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
1411
- | `options` | `object` | ✅ | — | — | |
1412
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1473
+ | Name | Type | Required | Default | Possible Values | Description |
1474
+ | --------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------ |
1475
+ | `options` | `object` | ✅ | — | — | |
1476
+ | ​ ↳ `app` | `string` | ✅ | — | — | App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3') |
1413
1477
 
1414
- **Returns:** `Promise<WorkflowItem>`
1478
+ **Returns:** `Promise<ConnectionStartUrlItem>`
1415
1479
 
1416
- | Name | Type | Required | Possible Values | Description |
1417
- | ------------- | --------- | -------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
1418
- | `data` | `object` | ✅ | — | |
1419
- | ​ ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
1420
- | ​ ↳ `enabled` | `boolean` | ✅ | — | Workflow's enabled state after the operation. Typically false; mirrors the row's true state in case a concurrent enable raced with this call. |
1480
+ | Name | Type | Required | Possible Values | Description |
1481
+ | --------------- | -------- | -------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1482
+ | `data` | `object` | ✅ | — | |
1483
+ | ​ ↳ `url` | `string` | ✅ | — | URL the user should open in their browser to complete the auth flow. Single-use, time-limited. |
1484
+ | ​ ↳ `expiresAt` | `number` | ✅ | — | Unix timestamp (seconds) after which the URL's signature is rejected by zapier.com. |
1485
+ | ​ ↳ `startedAt` | `number` | ✅ | — | Unix timestamp (seconds) when the server minted the URL. Use it as the `startedAt` for `wait-for-new-connection` so polling is anchored to server time rather than a possibly-skewed client clock. |
1486
+ | ​ ↳ `app` | `string` | ✅ | — | Versionless app key the URL was minted for (e.g., 'SlackCLIAPI'). Useful for downstream filtering. |
1421
1487
 
1422
1488
  **Example:**
1423
1489
 
1424
1490
  ```typescript
1425
- const { data: workflow } = await zapier.disableWorkflow({
1426
- workflow: "example-workflow",
1491
+ const { data: connectionStartUrl } = await zapier.getConnectionStartUrl({
1492
+ app: "example-app",
1427
1493
  });
1428
1494
  ```
1429
1495
 
1430
- #### `discardWorkflowDraft` 🧪 _experimental_
1496
+ #### `listConnections`
1431
1497
 
1432
- Discard an open workflow draft (soft delete). The draft's unpublished edits stop resolving; the published version is untouched.
1498
+ List available connections with optional filtering
1433
1499
 
1434
1500
  **Parameters:**
1435
1501
 
1436
- | Name | Type | Required | Default | Possible Values | Description |
1437
- | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
1438
- | `options` | `object` | ✅ | — | — | |
1439
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1440
- | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
1502
+ | Name | Type | Required | Default | Possible Values | Description |
1503
+ | ------------------- | --------- | -------- | ------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
1504
+ | `options` | `object` | ✅ | — | — | |
1505
+ | ​ ↳ `search` | `string` | ❌ | — | — | Search term to filter connections by title |
1506
+ | ​ ↳ `title` | `string` | ❌ | — | — | Filter connections by exact title match (searches first, then filters locally) |
1507
+ | ​ ↳ `owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own connections or a specific user ID |
1508
+ | ​ ↳ `app` | `string` | ❌ | — | — | App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github') |
1509
+ | ​ ↳ `connections` | `array` | ❌ | — | — | List of connection IDs to filter by |
1510
+ | ​ ↳ `account` | `string` | ❌ | — | — | Account to filter by |
1511
+ | ​ ↳ `includeShared` | `boolean` | ❌ | — | — | Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections. |
1512
+ | ​ ↳ `status` | `string` | ❌ | — | `active`, `expired`, `all` | Filter connections by expiry: 'active' (default) returns only non-expired connections, 'expired' only expired ones, and 'all' returns both. |
1513
+ | ​ ↳ `pageSize` | `number` | ❌ | — | — | Number of connections per page. The upstream API may cap this and reject values above its limit. |
1514
+ | ​ ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
1515
+ | ​ ↳ `cursor` | `string` | ❌ | — | — | Cursor to start from |
1441
1516
 
1442
- **Returns:** `Promise<WorkflowDraftItem>`
1517
+ **Returns:** `Promise<PaginatedResult<ConnectionItem>>`
1443
1518
 
1444
- | Name | Type | Required | Possible Values | Description |
1445
- | ---------------------------- | -------- | -------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
1446
- | `data` | `object` | ✅ | — | |
1447
- | ​ ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
1448
- | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
1449
- | ​ ↳ `slug` | `string` | ✅ | — | Human-friendly display name, not an identifier: two open drafts of a workflow may share one |
1450
- | ​ ↳ `base_version_id` | `string` | ✅ | — | The version this draft was forked from (the live version at draft creation), or null when the workflow had no published version yet |
1451
- | ​ ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
1452
- | ​ ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this draft |
1453
- | ​ ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this draft (or null) |
1454
- | ​ ↳ `draft_revision` | `number` | ✅ | — | Monotonic revision counter for optimistic concurrency. Echo it back on draft updates to detect concurrent edits. |
1455
- | ​ ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
1456
- | ​ ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who created (forked) this draft |
1457
- | ​ ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
1458
- | ​ ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
1459
- | ​ ↳ `discarded_at` | `string` | ✅ | — | When the draft was discarded (ISO-8601), or null while open |
1460
- | ​ ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
1461
- | ​ ↳ `updated_at` | `string` | ✅ | — | When the draft row was last updated (ISO-8601) |
1462
- | ​ ↳ `trigger` | `object` | ✅ | — | Trigger configuration held on this draft, or null for webhook-only workflows. |
1463
- | ​ ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this draft (or null). |
1464
- | ​ ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this draft (or null). |
1519
+ | Name | Type | Required | Possible Values | Description |
1520
+ | ------------------------------ | ---------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
1521
+ | `data[]` | `object[]` | ✅ | — | |
1522
+ | ​ ↳ `id` | `string` | ✅ | — | Unique identifier for the connection |
1523
+ | ​ ↳ `date` | `string` | ✅ | — | Date created |
1524
+ | ​ ↳ `lastchanged` | `string` | ❌ | — | Date last changed |
1525
+ | ​ ↳ `account_id` | `string` | ✅ | — | Account ID associated with this connection |
1526
+ | ​ ↳ `slug` | `string` | ❌ | — | Human-readable app slug for this connection's integration (e.g. 'google-sheets'). Null when no slug is registered for the app. |
1527
+ | ​ ↳ `destination_selected_api` | `string` | ❌ | — | Destination API key (if applicable) |
1528
+ | ​ ↳ `is_invite_only` | `boolean` | ✅ | — | Whether the connection is invite-only |
1529
+ | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the connection is private |
1530
+ | ​ ↳ `shared_with_all` | `boolean` | ✅ | — | Whether the connection is shared with all users |
1531
+ | ​ ↳ `is_stale` | `string` | ❌ | — | Stale status string |
1532
+ | ​ ↳ `is_shared` | `string` | ❌ | — | Shared status string |
1533
+ | ​ ↳ `marked_stale_at` | `string` | ❌ | — | Date when marked stale |
1534
+ | ​ ↳ `label` | `string` | ❌ | — | User label for the connection |
1535
+ | ​ ↳ `identifier` | `string` | ❌ | — | Identifier |
1536
+ | ​ ↳ `title` | `string` | ❌ | — | Title of the connection |
1537
+ | ​ ↳ `url` | `string` | ❌ | — | URL to the connection resource |
1538
+ | ​ ↳ `groups` | `array` | ❌ | — | Array of groups associated with the connection |
1539
+ | ​ ↳ `members` | `string` | ❌ | — | Members associated with the connection |
1540
+ | ​ ↳ `permissions` | `object` | ❌ | — | Permissions for the connection |
1541
+ | ​ ↳ `public_id` | `string` | ❌ | — | Public UUID for the connection |
1542
+ | ​ ↳ `account_public_id` | `string` | ❌ | — | Public UUID for the associated account |
1543
+ | ​ ↳ `customuser_public_id` | `string` | ❌ | — | Public UUID for the associated custom user |
1544
+ | ​ ↳ `implementation_id` | `string` | ❌ | — | Implementation ID (was selected_api) |
1545
+ | ​ ↳ `profile_id` | `string` | ❌ | — | Profile ID (was customuser_id) |
1546
+ | ​ ↳ `is_expired` | `string` | ❌ | — | Whether the connection is expired (mapped from is_stale) |
1547
+ | ​ ↳ `expired_at` | `string` | ❌ | — | Date when connection expired (mapped from marked_stale_at) |
1548
+ | ​ ↳ `app_key` | `string` | ❌ | — | App Key extracted from implementation_id |
1549
+ | ​ ↳ `app_version` | `string` | ❌ | — | App Version extracted from implementation_id |
1550
+ | ​ ↳ `is_managed` | `boolean` | ❌ | — | Whether this connection is managed by account admins (no individual owner) |
1551
+ | `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
1465
1552
 
1466
1553
  **Example:**
1467
1554
 
1468
1555
  ```typescript
1469
- const result = await zapier.discardWorkflowDraft({
1470
- workflow: "example-workflow",
1471
- draft: "example-draft",
1472
- });
1556
+ // Get first page and a cursor for the second page
1557
+ const { data: connections, nextCursor } = await zapier.listConnections();
1558
+
1559
+ // Or iterate over all pages
1560
+ for await (const page of zapier.listConnections().pages()) {
1561
+ // Do something with each page
1562
+ }
1563
+
1564
+ // Or iterate over individual items across all pages
1565
+ for await (const connection of zapier.listConnections().items()) {
1566
+ // Do something with each connection
1567
+ }
1473
1568
  ```
1474
1569
 
1475
- #### `enableAgenticManagement` 🧪 _experimental_
1570
+ #### `waitForNewConnection`
1476
1571
 
1477
- Put one workflow under Agentic Management. A workflow disabled earlier comes back with the modes and auto-approve choice it had, unless you pass new ones here.
1572
+ Wait for a new connection to appear for the given app. Polls the connections list newest-first until the most recent matching row's `date` is at or after the started-at timestamp, then returns it. Pair with `get-connection-start-url` — that mints the URL the user opens, this waits for the resulting connection to land. Errors with a timeout after the configured timeout (default 5 min). Example (JS):
1573
+
1574
+ ```ts
1575
+ const {
1576
+ data: { url, app, startedAt },
1577
+ } = await zapier.getConnectionStartUrl({ app: "slack" });
1578
+ // show `url` to the user via the channel they're reading from
1579
+ const { data: conn } = await zapier.waitForNewConnection({ app, startedAt });
1580
+ ```
1478
1581
 
1479
1582
  **Parameters:**
1480
1583
 
1481
- | Name | Type | Required | Default | Possible Values | Description |
1482
- | ----------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1483
- | `options` | `object` | ✅ | — | — | |
1484
- | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to put under agentic management. |
1485
- | ​ ↳ `modes` | `array` | ❌ | — | — | The modes to run for this workflow. Omit it and the workflow starts on `heal` alone. A mode is what Agentic Management watches for and what it changes in response. `heal` monitors runs for errors and, when something breaks, diagnoses the cause and drafts and tests a fix; it is the mode a workflow gets by default. `expand` grows what the workflow covers: it reviews runs that succeeded without actually doing anything — a lookup that matched nothing, a filter that passed no items, a trigger payload no branch handles — and proposes a new branch or step to handle that case, rather than rewriting the ones that already work. `harden` watches the AI steps: when an AI step keeps doing the same work the same way, it converts that step into fixed code, so the workflow runs faster, costs less, and behaves the same way every time. Modes stack — each one you name runs alongside the others, and a mode you leave out does nothing, so a workflow on `expand` alone does not repair failed runs. Whether a change goes live on its own or waits for someone to approve it is `autoApprove`, not the mode. |
1486
- | ​ ↳ `autoApprove` | `boolean` | ❌ | — | — | Apply the fixes Agentic Management proposes without asking first. Set it to false and each fix waits for someone to approve it. Omit it and fixes are applied without asking, which is what a workflow enabled for the first time gets; a workflow being re-enabled keeps the setting it had before. |
1584
+ | Name | Type | Required | Default | Possible Values | Description |
1585
+ | ------------------------------ | -------- | -------- | ------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1586
+ | `options` | `object` | ✅ | — | — | |
1587
+ | ​ ↳ `app` | `string` | ✅ | — | — | App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3') |
1588
+ | ​ ↳ `startedAt` | `number` | ✅ | — | — | Unix timestamp (seconds). Only connections whose `date` is at or after this value count as 'new'. Prefer the `startedAt` returned by `get-connection-start-url` — it's server-stamped, so the comparison isn't thrown off by client clock skew. If you mint the timestamp yourself, capture it _before_ showing the start URL so a fast OAuth completion isn't missed. |
1589
+ | ​ ↳ `timeoutSeconds` | `number` | ❌ | — | — | How long to wait before giving up. Default 5 minutes (300). |
1590
+ | ​ ↳ `pollIntervalMilliseconds` | `number` | ❌ | — | — | Delay before the first poll request, in ms. Default 3 seconds (3_000). Subsequent polling cadence is managed by the SDK's polling primitive (backoff with sane defaults). |
1487
1591
 
1488
- **Returns:** `Promise<AgenticManagementEnableResultItem>`
1592
+ **Returns:** `Promise<ConnectionItem>`
1489
1593
 
1490
- | Name | Type | Required | Possible Values | Description |
1491
- | ---------------- | -------- | -------- | --------------- | ----------------------------------------------------------------------- |
1492
- | `data` | `object` | ✅ | — | |
1493
- | ​ ↳ `manager_id` | `string` | ✅ | — | ID of the manager automation Zapier provisioned to watch this workflow. |
1594
+ | Name | Type | Required | Possible Values | Description |
1595
+ | ----------- | -------- | -------- | --------------- | ------------------------------------------------------------------------------------ |
1596
+ | `data` | `object` | ✅ | — | |
1597
+ | ​ ↳ `id` | `string` | ✅ | — | The new connection's ID. Public UUID when available, falling back to the numeric ID. |
1598
+ | ​ ↳ `app` | `string` | ✅ | — | Versionless app key the connection was created for (e.g., 'SlackCLIAPI'). |
1599
+ | ​ ↳ `title` | `string` | ❌ | — | Human-readable connection title set by the auth flow, when available. |
1494
1600
 
1495
1601
  **Example:**
1496
1602
 
1497
1603
  ```typescript
1498
- const { data: agenticManagementEnableResult } =
1499
- await zapier.enableAgenticManagement({
1500
- workflow: "example-workflow",
1501
- });
1604
+ const { data: connection } = await zapier.waitForNewConnection({
1605
+ app: "example-app",
1606
+ startedAt: 100,
1607
+ });
1502
1608
  ```
1503
1609
 
1504
- #### `enableWorkflow` 🧪 _experimental_
1610
+ ### HTTP Requests
1505
1611
 
1506
- Enable a durable workflow so it accepts triggers
1612
+ Make authenticated requests to an app's API through Zapier's API proxy, using a connection's credentials so your code never handles tokens or keys. Useful when an app's actions don't cover what you need.
1507
1613
 
1508
- **Parameters:**
1614
+ #### `fetch`
1509
1615
 
1510
- | Name | Type | Required | Default | Possible Values | Description |
1511
- | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
1512
- | `options` | `object` | ✅ | — | — | |
1513
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1616
+ Make authenticated HTTP requests to any API through Zapier. Pass a connectionId to automatically inject the user's stored credentials (OAuth tokens, API keys, etc.) into the outgoing request. Mirrors the native fetch(url, init?) signature with additional Zapier-specific options.
1514
1617
 
1515
- **Returns:** `Promise<WorkflowItem>`
1618
+ **Parameters:**
1516
1619
 
1517
- | Name | Type | Required | Possible Values | Description |
1518
- | ------------- | --------- | -------- | --------------- | ---------------------------------------------------------- |
1519
- | `data` | `object` | ✅ | — | |
1520
- | ​ ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
1521
- | ​ ↳ `enabled` | `boolean` | ✅ | — | Workflow's enabled state after the operation (always true) |
1620
+ | Name | Type | Required | Default | Possible Values | Description |
1621
+ | -------------------- | ------------------------ | -------- | ------- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1622
+ | `url` | `string, custom` | ✅ | — | — | The full URL of the API endpoint to call (proxied through Zapier's API Proxy) |
1623
+ | `init` | `object` | ❌ | — | — | Request options including method, headers, body, and authentication |
1624
+ | ​ ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method for the request (defaults to GET) |
1625
+ | ​ ↳ `headers` | `object` | ❌ | — | — | HTTP headers to include in the request |
1626
+ | ​ ↳ `body` | `string, custom, record` | ❌ | — | — | Request body — plain objects and JSON strings are auto-detected and Content-Type is set accordingly |
1627
+ | ​ ↳ `connection` | `string, number` | ❌ | — | — | Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. |
1628
+ | ​ ↳ `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
1629
+ | ​ ↳ `idempotencyKey` | `string` | ❌ | — | — | Key used to make API Proxy retries safe from duplicate side effects |
1630
+ | ​ ↳ `maxTimeSeconds` | `number` | ❌ | — | — | Maximum seconds to wait for a response. Honored on a best-effort basis; the server may silently enforce a lower ceiling. |
1631
+
1632
+ **Returns:** `Promise<Response>`
1522
1633
 
1523
1634
  **Example:**
1524
1635
 
1525
1636
  ```typescript
1526
- const { data: workflow } = await zapier.enableWorkflow({
1527
- workflow: "example-workflow",
1528
- });
1637
+ const result = await zapier.fetch("https://example.com", {});
1529
1638
  ```
1530
1639
 
1531
- #### `getAgenticManagementConfig` 🧪 _experimental_
1640
+ ### Human Inputs (Experimental)
1532
1641
 
1533
- Read the Agentic Management config for one workflow.
1534
-
1535
- **Parameters:**
1536
-
1537
- | Name | Type | Required | Default | Possible Values | Description |
1538
- | -------------- | -------- | -------- | ------- | --------------- | --------------------------- |
1539
- | `options` | `object` | ✅ | — | — | |
1540
- | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to read. |
1541
-
1542
- **Returns:** `Promise<AgenticManagementConfigItem>`
1543
-
1544
- | Name | Type | Required | Possible Values | Description |
1545
- | ------------------ | --------- | -------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1546
- | `data` | `object` | ✅ | — | |
1547
- | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow this config describes. |
1548
- | ​ ↳ `enabled` | `boolean` | ✅ | — | Whether Agentic Management is currently active for this workflow. |
1549
- | ​ ↳ `auto_approve` | `boolean` | ✅ | — | Whether fixes are applied without asking for approval first. `false` when Agentic Management has never been set up for this workflow. |
1550
- | ​ ↳ `modes` | `array` | ✅ | — | The modes the workflow runs. Still listed while `enabled` is false, because the settings are kept for a later re-enable — so read `enabled` to tell whether they are in effect, not this list. |
1551
- | ​ ↳ `manager_id` | `string` | ❌ | — | ID of the manager automation Zapier provisioned for this workflow, once one exists; `null` otherwise. Use it to link to that automation to see the runs it has taken. |
1552
-
1553
- **Example:**
1642
+ Collect information from people with Zapier Forms. Use these to create a form and share its link to gather responses.
1554
1643
 
1555
- ```typescript
1556
- const { data: agenticManagementConfig } =
1557
- await zapier.getAgenticManagementConfig({
1558
- workflow: "example-workflow",
1559
- });
1560
- ```
1644
+ > ℹ️ **Experimental.** Still being designed; may change shape or disappear in any release, without notice. Import from `"@zapier/zapier-sdk/experimental"` to use these methods.
1561
1645
 
1562
- #### `getAgenticManagementIntent` 🧪 _experimental_
1646
+ #### `createForm` 🧪 _experimental_
1563
1647
 
1564
- Read the intent recorded for one workflow version: the plain-language description of what that version of the workflow is meant to do.
1648
+ Create a Zapier Form from a title and optional fields. Forms publish by default and return a shareable `hosted_url`; set `draft` to save without publishing.
1565
1649
 
1566
1650
  **Parameters:**
1567
1651
 
1568
- | Name | Type | Required | Default | Possible Values | Description |
1569
- | -------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1570
- | `options` | `object` | ✅ | — | — | |
1571
- | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to read. |
1572
- | ​ ↳ `version` | `string` | ❌ | — | — | The workflow version the intent belongs to. Each version stores its own intent, and a version never picks up the intent of another, so publishing a new version starts it with none. Omit this to use the workflow's current published version. |
1652
+ | Name | Type | Required | Default | Possible Values | Description |
1653
+ | ------------------------- | ---------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1654
+ | `options` | `object` | ✅ | — | — | |
1655
+ | ​ ↳ `title` | `string` | ✅ | — | — | The title shown in the Forms UI and on the form. |
1656
+ | ​ ↳ `description` | `string` | ❌ | — | — | An optional description of the form. |
1657
+ | ​ ↳ `fields[]` | `object[]` | ❌ | — | — | Initial fields to add to the form. |
1658
+ | ​   ↳ `label` | `string` | ✅ | — | — | Human-readable label shown above the input. |
1659
+ | ​   ↳ `type` | `string` | ✅ | — | `short_text`, `long_text`, `email`, `number`, `yes_no`, `url`, `date`, `date_range`, `currency`, `phone_number`, `dropdown`, `integration_backed` | The type of field. |
1660
+ | ​   ↳ `required` | `boolean` | ❌ | — | — | Whether the field must be answered before the form can submit. |
1661
+ | ​   ↳ `disabled` | `boolean` | ❌ | — | — | When true, the field is rendered read-only — shown but not editable. A rendering hint only; it is not enforced during submission validation. |
1662
+ | ​   ↳ `variant` | `string` | ❌ | — | `checkbox`, `radio` | For `yes_no` fields: `checkbox` renders a single toggle, `radio` renders explicit yes/no buttons. Defaults to `checkbox`. |
1663
+ | ​   ↳ `multiUrl` | `boolean` | ❌ | — | — | For `url` fields: when true the field accepts a list of URLs, otherwise a single URL. Defaults to false. |
1664
+ | ​   ↳ `includeTime` | `boolean` | ❌ | — | — | For `date` and `date_range` fields: when true the picker also captures a time. Defaults to false. |
1665
+ | ​   ↳ `currencyFormat` | `string` | ❌ | — | — | For `currency` fields: ISO 4217 currency code (e.g. `usd`, `eur`). Controls the symbol shown in the form UI. |
1666
+ | ​   ↳ `decimals` | `literal` | ❌ | — | — | For `currency` fields: allowed decimal places. `0` for whole numbers, `2` for up to two decimal places. Defaults to `2`. |
1667
+ | ​   ↳ `defaultCountry` | `string` | ❌ | — | — | For `phone_number` fields: ISO 3166-1 alpha-2 code for the default selected country (e.g. `US`). Defaults to `US`. |
1668
+ | ​   ↳ `phoneNumberFormat` | `string` | ❌ | — | `national`, `international` | For `phone_number` fields: `national` omits the country-code prefix, `international` includes it. Defaults to `national`. |
1669
+ | ​   ↳ `acceptedCountries` | `array` | ❌ | — | — | For `phone_number` fields: restrict input to specific ISO 3166-1 alpha-2 country codes. Omit to allow all countries. |
1670
+ | ​   ↳ `options[]` | `object[]` | ❌ | — | — | For `dropdown` fields: the selectable options. At least one is required. |
1671
+ | ​     ↳ `value` | `string` | ✅ | — | — | The value submitted when this option is selected. |
1672
+ | ​     ↳ `label` | `string` | ✅ | — | — | Human-readable label shown to the user. |
1673
+ | ​   ↳ `multiSelect` | `boolean` | ❌ | — | — | For `dropdown` fields: when true the user may select multiple options. Defaults to false. |
1674
+ | ​   ↳ `dataSource` | `object` | ❌ | — | — | For `integration_backed` fields: where to fetch the field's options from at render time. |
1675
+ | ​     ↳ `app` | `string` | ✅ | — | — | Zapier app to pull options from. See `listApps` for the catalog. |
1676
+ | ​     ↳ `actionType` | `string` | ✅ | — | `read`, `read_bulk` | Whether the data source returns a single record (`read`) or a collection (`read_bulk`). |
1677
+ | ​     ↳ `resource` | `string` | ✅ | — | — | Resource name within the app — typically a trigger or search key from the app's definition. |
1678
+ | ​     ↳ `valueKey` | `string` | ❌ | — | — | Property on each returned record to use as the submitted option value. Defaults to `id`. |
1679
+ | ​     ↳ `labelKey` | `string` | ❌ | — | — | Property on each returned record to use as the displayed option label. Defaults to a sensible name field. |
1680
+ | ​ ↳ `draft` | `boolean` | ❌ | — | — | When true, save without publishing. Omit to publish immediately, making `hosted_url` live. |
1681
+ | ​ ↳ `confirmationTitle` | `string` | ❌ | — | — | Heading shown to the respondent after they submit. Omit to use the form renderer's default. |
1682
+ | ​ ↳ `confirmationMessage` | `string` | ❌ | — | — | Message shown to the respondent after they submit, below the confirmation title. Omit to use the form renderer's default. |
1683
+ | ​ ↳ `callbackUrl` | `string` | ❌ | — | — | Absolute http/https URL notified with the submission JSON each time the form is answered. |
1684
+ | ​ ↳ `consumerAuth` | `string` | ❌ | — | `none`, `zapier` | Who may open the published form. `none` (the default) leaves it public to anyone with the link; `zapier` requires the visitor to be signed in to Zapier on the form's owning account. |
1685
+ | ​ ↳ `document` | `object` | ❌ | — | — | Escape hatch: a complete form document tree, sent as-is. When supplied it replaces the document built from `fields`, and `title`, `description`, `confirmationTitle`, and `confirmationMessage` are ignored. Use only for structures the flat field list cannot express, such as approval decisions or multi-column row layout. |
1686
+ | ​   ↳ `id` | `string` | ✅ | — | — | |
1687
+ | ​   ↳ `type` | `string` | ✅ | — | `root` | |
1688
+ | ​   ↳ `attrs` | `object` | ✅ | — | — | |
1689
+ | ​     ↳ `schema_version` | `number` | ✅ | — | — | |
1690
+ | ​     ↳ `title` | `string` | ✅ | — | — | |
1691
+ | ​   ↳ `children` | `array` | ❌ | — | — | |
1573
1692
 
1574
- **Returns:** `Promise<AgenticManagementIntentItem>`
1693
+ **Returns:** `Promise<FormItem>`
1575
1694
 
1576
- | Name | Type | Required | Possible Values | Description |
1577
- | ------------------------- | -------- | -------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1578
- | `data` | `object` | ✅ | — | |
1579
- | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow the intent belongs to. |
1580
- | ​ ↳ `workflow_version_id` | `string` | ✅ | — | The version this read or write actually landed on, so you can tell which one answered when you omitted `version`. `null` only when you read a workflow that has nothing published yet. |
1581
- | ​ ↳ `intent` | `string` | ✅ | — | The intent stored for this version, or `null` when this version has none. Intent is never carried over from another version. |
1582
- | ​ ↳ `updated_at` | `string` | ❌ | — | When the intent was last written; `null` when never captured. |
1695
+ | Name | Type | Required | Possible Values | Description |
1696
+ | ----------------------- | --------- | -------- | --------------- | ----------- |
1697
+ | `data` | `object` | ✅ | — | |
1698
+ | ​ ↳ `id` | `string` | ✅ | — | |
1699
+ | ​ ↳ `title` | `string` | ✅ | — | |
1700
+ | ​ ↳ `description` | `string` | ❌ | — | |
1701
+ | ​ ↳ `hosted_url` | `string` | ✅ | — | |
1702
+ | ​ ↳ `submission_count` | `number` | ✅ | — | |
1703
+ | ​ ↳ `account_id` | `number` | ✅ | — | |
1704
+ | ​ ↳ `owner_id` | `string` | ✅ | — | |
1705
+ | ​ ↳ `created_at` | `string` | ✅ | — | |
1706
+ | ​ ↳ `updated_at` | `string` | ✅ | — | |
1707
+ | ​ ↳ `document` | `unknown` | ✅ | — | |
1708
+ | ​ ↳ `last_published_at` | `string` | ✅ | — | |
1709
+ | ​ ↳ `consumer_auth` | `unknown` | ✅ | — | |
1710
+ | ​ ↳ `callback_url` | `unknown` | ✅ | — | |
1583
1711
 
1584
1712
  **Example:**
1585
1713
 
1586
1714
  ```typescript
1587
- const { data: agenticManagementIntent } =
1588
- await zapier.getAgenticManagementIntent({
1589
- workflow: "example-workflow",
1590
- });
1715
+ const { data: form } = await zapier.createForm({
1716
+ title: "example-title",
1717
+ });
1591
1718
  ```
1592
1719
 
1593
- #### `getDurableRun` 🧪 _experimental_
1720
+ ### Next Gen Zaps (Experimental)
1594
1721
 
1595
- Get the full state of a run-once durable run, including its operations journal
1722
+ Next Gen Zaps are a new version of Zaps that run on code, which makes them easier for agents and AI tools to understand. Use these to build, test, publish, and run Next Gen Zaps, and to check on their runs.
1723
+
1724
+ > ℹ️ **Experimental.** Still being designed; may change shape or disappear in any release, without notice. Import from `"@zapier/zapier-sdk/experimental"` to use these methods.
1725
+
1726
+ #### `cancelDurableRun` 🧪 _experimental_
1727
+
1728
+ Cancel a run-once durable run in initialized or started status. Returns 409 if the run is already terminal.
1596
1729
 
1597
1730
  **Parameters:**
1598
1731
 
@@ -1603,127 +1736,67 @@ Get the full state of a run-once durable run, including its operations journal
1603
1736
 
1604
1737
  **Returns:** `Promise<DurableRunItem>`
1605
1738
 
1606
- | Name | Type | Required | Possible Values | Description |
1607
- | ---------------- | --------- | -------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
1608
- | `data` | `object` | ✅ | — | |
1609
- | ​ ↳ `id` | `string` | ✅ | — | Run ID (UUID) |
1610
- | ​ ↳ `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
1611
- | ​ ↳ `input` | `unknown` | ✅ | — | Input data passed to the run |
1612
- | ​ ↳ `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
1613
- | ​ ↳ `error` | `object` | ✅ | — | Structured error details when the run failed (null otherwise) |
1614
- | ​ ↳ `execution` | `object` | ✅ | — | Linked execution, including the operations journal. Null while the run is still in `initialized` state. |
1615
- | ​ ↳ `is_private` | `boolean` | ✅ | — | When true, the run is visible only to the creating user; otherwise visible across the account. |
1616
- | ​ ↳ `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
1617
- | ​ ↳ `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
1739
+ | Name | Type | Required | Possible Values | Description |
1740
+ | ------------ | -------- | -------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1741
+ | `data` | `object` | ✅ | — | |
1742
+ | ​ ↳ `id` | `string` | ✅ | — | Run ID that was targeted |
1743
+ | ​ ↳ `status` | `string` | ✅ | `cancelled` | Always `cancelled` on a successful call. Synthesized client-side — the backend returns 204; callers needing the run's full state should follow up with getDurableRun. |
1618
1744
 
1619
1745
  **Example:**
1620
1746
 
1621
1747
  ```typescript
1622
- const { data: durableRun } = await zapier.getDurableRun({
1748
+ const { data: durableRun } = await zapier.cancelDurableRun({
1623
1749
  run: "example-run",
1624
1750
  });
1625
1751
  ```
1626
1752
 
1627
- #### `getTriggerRun` 🧪 _experimental_
1628
-
1629
- Get the workflow run associated with a deployed workflow's trigger. Useful immediately after firing a trigger, when you have the trigger ID but not yet the run ID.
1630
-
1631
- **Parameters:**
1632
-
1633
- | Name | Type | Required | Default | Possible Values | Description |
1634
- | ------------- | -------- | -------- | ------- | --------------- | ------------------- |
1635
- | `options` | `object` | ✅ | — | — | |
1636
- | ​ ↳ `trigger` | `string` | ✅ | — | — | Workflow trigger ID |
1637
-
1638
- **Returns:** `Promise<WorkflowRunItem>`
1639
-
1640
- | Name | Type | Required | Possible Values | Description |
1641
- | ------------------------- | --------- | -------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- |
1642
- | `data` | `object` | ✅ | — | |
1643
- | ​ ↳ `id` | `string` | ✅ | — | Workflow run ID (UUID) |
1644
- | ​ ↳ `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
1645
- | ​ ↳ `workflow_version_id` | `string` | ✅ | — | Workflow version the run is bound to |
1646
- | ​ ↳ `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
1647
- | ​ ↳ `input` | `unknown` | ✅ | — | Input passed to the run |
1648
- | ​ ↳ `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
1649
- | ​ ↳ `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
1650
- | ​ ↳ `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
1651
- | ​ ↳ `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
1652
-
1653
- **Example:**
1654
-
1655
- ```typescript
1656
- const { data: workflowRun } = await zapier.getTriggerRun({
1657
- trigger: "example-trigger",
1658
- });
1659
- ```
1660
-
1661
- #### `getWorkflow` 🧪 _experimental_
1753
+ #### `createWorkflow` 🧪 _experimental_
1662
1754
 
1663
- Get a durable workflow with its current version details and trigger claim status
1755
+ Create a durable workflow container. Starts disabled with no version; publish a version to add code.
1664
1756
 
1665
1757
  **Parameters:**
1666
1758
 
1667
- | Name | Type | Required | Default | Possible Values | Description |
1668
- | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
1669
- | `options` | `object` | ✅ | — | — | |
1670
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1759
+ | Name | Type | Required | Default | Possible Values | Description |
1760
+ | ----------------- | --------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------- |
1761
+ | `options` | `object` | ✅ | — | — | |
1762
+ | ​ ↳ `name` | `string` | ✅ | — | — | Workflow name |
1763
+ | ​ ↳ `description` | `string` | ❌ | — | — | Optional description for the workflow |
1764
+ | ​ ↳ `private` | `boolean` | ❌ | — | — | If true, only the creating user can see or manage this workflow. Defaults to false (account-visible). |
1671
1765
 
1672
1766
  **Returns:** `Promise<WorkflowItem>`
1673
1767
 
1674
- | Name | Type | Required | Possible Values | Description |
1675
- | ------------------------------ | ---------- | -------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1676
- | `data` | `object` | ✅ | — | |
1677
- | ​ ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
1678
- | ​ ↳ `name` | `string` | ✅ | — | Workflow name |
1679
- | ​ ↳ `description` | `string` | ✅ | — | Optional workflow description (null if unset) |
1680
- | ​ ↳ `trigger_url` | `string` | ✅ | — | Public URL that fires this workflow when POSTed to. Embeds a trigger token in the path — treat as sensitive. Requests must also be authenticated as the account. |
1681
- | ​ ↳ `editor_url` | `string` | ✅ | — | URL to the Zapier workflow editor for this workflow |
1682
- | ​ ↳ `enabled` | `boolean` | ✅ | — | Whether the workflow currently accepts triggers |
1683
- | ​ ↳ `disabled_reason` | `string` | ❌ | `trigger_claim_failed` | Why the workflow is off, when system-disabled. Null when not system-disabled. Independent of per-trigger claim status: an enabled workflow can still have a failed trigger. |
1684
- | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the workflow is private to the creating user. False means account-visible. |
1685
- | ​ ↳ `created_by_user_id` | `string` | ✅ | — | User ID of the workflow creator (null in legacy data) |
1686
- | ​ ↳ `current_version` | `object` | ❌ | — | The currently published version, if any. Absent for workflows with no version published yet. |
1687
- | ​   ↳ `id` | `string` | ✅ | — | Workflow version ID (UUID) |
1688
- | ​   ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID |
1689
- | ​   ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
1690
- | ​   ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this version's runs |
1691
- | ​   ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this version (or null) |
1692
- | ​   ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who published this version |
1693
- | ​   ↳ `created_at` | `string` | ✅ | — | When the version was published (ISO-8601) |
1694
- | ​   ↳ `trigger` | `object` | ✅ | — | Trigger configuration persisted on this version, or null for webhook-only workflows. |
1695
- | ​   ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this version (or null). |
1696
- | ​   ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this version (or null). |
1697
- | ​ ↳ `triggers[]` | `object[]` | ✅ | — | Trigger configurations from the current version, with live claim status. Empty array when the workflow has no triggers. |
1698
- | ​   ↳ `selected_api` | `string` | ✅ | — | Zapier app/API identifier (e.g. 'GoogleSheetsAPI') |
1699
- | ​   ↳ `action` | `string` | ✅ | — | Trigger action key (e.g. 'new_row') |
1700
- | ​   ↳ `authentication_id` | `string` | ❌ | — | Connection ID for the trigger source. Null for no-auth triggers. |
1701
- | ​   ↳ `params` | `object` | ❌ | — | Trigger parameters as a JSON object |
1702
- | ​   ↳ `status` | `string` | ✅ | `unclaimed`, `pending`, `active`, `releasing`, `released`, `failed` | Live trigger claim status — whether the trigger is currently subscribed to its source. |
1703
- | ​   ↳ `error` | `string` | ❌ | — | Failure reason for the latest claim. Present (non-null) only when status is 'failed'. |
1704
- | ​   ↳ `details` | `object` | ❌ | — | Trigger-type-specific metadata; shape varies by trigger type (e.g. `webhook_url` on catch-hook triggers). Null or absent when none applies. |
1705
- | ​ ↳ `created_at` | `string` | ✅ | — | When the workflow was created (ISO-8601) |
1706
- | ​ ↳ `updated_at` | `string` | ✅ | — | When the workflow was last modified (ISO-8601) |
1768
+ | Name | Type | Required | Possible Values | Description |
1769
+ | ------------------------ | --------- | -------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1770
+ | `data` | `object` | ✅ | — | |
1771
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
1772
+ | ​ ↳ `name` | `string` | ✅ | — | Workflow name |
1773
+ | ​ ↳ `description` | `string` | ✅ | — | Workflow description (null if unset) |
1774
+ | ​ ↳ `trigger_url` | `string` | ✅ | — | Public URL that fires this workflow when POSTed to. Embeds a trigger token in the path — treat as sensitive. Requests must also be authenticated as the account. |
1775
+ | ​ ↳ `editor_url` | `string` | ✅ | — | URL to the Zapier workflow editor for this workflow |
1776
+ | ​ ↳ `enabled` | `boolean` | ✅ | — | Whether the workflow currently accepts triggers. Always false on a new workflow until enabled. |
1777
+ | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the workflow is private to the creating user. False means account-visible. |
1778
+ | ​ ↳ `created_by_user_id` | `string` | ✅ | — | User ID of the workflow creator (null in legacy data) |
1779
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the workflow was created (ISO-8601) |
1707
1780
 
1708
1781
  **Example:**
1709
1782
 
1710
1783
  ```typescript
1711
- const { data: workflow } = await zapier.getWorkflow({
1712
- workflow: "example-workflow",
1784
+ const { data: workflow } = await zapier.createWorkflow({
1785
+ name: "example-name",
1713
1786
  });
1714
1787
  ```
1715
1788
 
1716
- #### `getWorkflowDraft` 🧪 _experimental_
1789
+ #### `createWorkflowDraft` 🧪 _experimental_
1717
1790
 
1718
- Get full details of a workflow draft including source files
1791
+ Fork a new draft from the workflow's current live version (or a blank stub before the first publish)
1719
1792
 
1720
1793
  **Parameters:**
1721
1794
 
1722
- | Name | Type | Required | Default | Possible Values | Description |
1723
- | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
1724
- | `options` | `object` | ✅ | — | — | |
1725
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1726
- | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
1795
+ | Name | Type | Required | Default | Possible Values | Description |
1796
+ | -------------- | -------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
1797
+ | `options` | `object` | ✅ | — | — | |
1798
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1799
+ | ​ ↳ `slug` | `string` | ❌ | — | — | Optional display name for the draft. When omitted, the server generates one. Need not be unique among the workflow's open drafts. |
1727
1800
 
1728
1801
  **Returns:** `Promise<WorkflowDraftItem>`
1729
1802
 
@@ -1752,75 +1825,66 @@ Get full details of a workflow draft including source files
1752
1825
  **Example:**
1753
1826
 
1754
1827
  ```typescript
1755
- const { data: workflowDraft } = await zapier.getWorkflowDraft({
1828
+ const { data: workflowDraft } = await zapier.createWorkflowDraft({
1756
1829
  workflow: "example-workflow",
1757
- draft: "example-draft",
1758
1830
  });
1759
1831
  ```
1760
1832
 
1761
- #### `getWorkflowRun` 🧪 _experimental_
1833
+ #### `deleteWorkflow` 🧪 _experimental_
1762
1834
 
1763
- Get the current state of a workflow run — a live run of a published workflow version, or a draft run launched via `runWorkflowDraft` (the `kind` field says which)
1835
+ Delete a durable workflow. Throws `ZapierNotFoundError` if the workflow doesn't exist; callers wanting idempotency should catch that themselves.
1764
1836
 
1765
1837
  **Parameters:**
1766
1838
 
1767
- | Name | Type | Required | Default | Possible Values | Description |
1768
- | -------------- | -------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------- |
1769
- | `options` | `object` | ✅ | — | — | |
1770
- | ​ ↳ `workflow` | `string` | ❌ | — | — | Parent workflow ID — used only to scope the CLI run-id picker; ignored by the API call. |
1771
- | ​ ↳ `run` | `string` | ✅ | — | — | Workflow run ID |
1839
+ | Name | Type | Required | Default | Possible Values | Description |
1840
+ | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
1841
+ | `options` | `object` | ✅ | — | — | |
1842
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1772
1843
 
1773
- **Returns:** `Promise<WorkflowRunItem>`
1844
+ **Returns:** `Promise<{ success: boolean }>`
1774
1845
 
1775
- | Name | Type | Required | Possible Values | Description |
1776
- | ------ | -------- | -------- | --------------- | -------------------------------------------------- |
1777
- | `data` | `object` | ✅ | — | One of the variants below, distinguished by `kind` |
1846
+ | Name | Type | Required | Possible Values | Description |
1847
+ | -------- | -------- | -------- | --------------- | ------------------------------------------ |
1848
+ | `data` | `object` | ✅ | — | |
1849
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow ID that was targeted for deletion |
1778
1850
 
1779
- **When `kind` is `"live"`:**
1851
+ **Example:**
1780
1852
 
1781
- | Name | Type | Required | Possible Values | Description |
1782
- | --------------------- | --------- | -------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- |
1783
- | `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
1784
- | `workflow_id` | `string` | ✅ | — | The workflow this run belongs to |
1785
- | `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
1786
- | `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
1787
- | `input` | `unknown` | ✅ | — | Input passed to the run |
1788
- | `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
1789
- | `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
1790
- | `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
1791
- | `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
1792
- | `kind` | `string` | ✅ | `live` | A run of a published workflow version. |
1793
- | `trigger_id` | `string` | ✅ | — | ID of the trigger that fired this run. Null for runs created without a trigger. |
1794
- | `workflow_version_id` | `string` | ✅ | — | Workflow version the run is bound to. Null in rare edge cases. |
1853
+ ```typescript
1854
+ const result = await zapier.deleteWorkflow({
1855
+ workflow: "example-workflow",
1856
+ });
1857
+ ```
1795
1858
 
1796
- **When `kind` is `"draft"`:**
1859
+ #### `disableAgenticManagement` 🧪 _experimental_
1797
1860
 
1798
- | Name | Type | Required | Possible Values | Description |
1799
- | ------------------- | --------- | -------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1800
- | `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
1801
- | `workflow_id` | `string` | ✅ | — | The workflow this run belongs to |
1802
- | `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
1803
- | `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
1804
- | `input` | `unknown` | ✅ | — | Input passed to the run |
1805
- | `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
1806
- | `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
1807
- | `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
1808
- | `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
1809
- | `kind` | `string` | ✅ | `draft` | A run launched from a workflow draft via `runWorkflowDraft`. |
1810
- | `workflow_draft_id` | `string` | ✅ | — | The draft this run was launched from. Null once that draft has been deleted (the run outlives its draft). |
1811
- | `draft_revision` | `number` | ✅ | — | The draft's revision at the moment this run was created. Compare against the draft's current `draft_revision` to tell whether the run still reflects the draft as it now stands. |
1861
+ Stop Agentic Management from working on one workflow. Its settings are kept, not deleted: the modes and auto-approve choice stay on file, so calling enableAgenticManagement later resumes with those settings instead of the defaults.
1862
+
1863
+ **Parameters:**
1864
+
1865
+ | Name | Type | Required | Default | Possible Values | Description |
1866
+ | -------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------- |
1867
+ | `options` | `object` | ✅ | — | — | |
1868
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to take out of agentic management. |
1869
+
1870
+ **Returns:** `Promise<{ success: boolean }>`
1871
+
1872
+ | Name | Type | Required | Possible Values | Description |
1873
+ | -------- | --------- | -------- | --------------- | -------------------------------------------------------------------- |
1874
+ | `data` | `object` | ✅ | — | |
1875
+ | ​ ↳ `ok` | `boolean` | ✅ | — | True when Zapier accepted the request to stop managing the workflow. |
1812
1876
 
1813
1877
  **Example:**
1814
1878
 
1815
1879
  ```typescript
1816
- const { data: workflowRun } = await zapier.getWorkflowRun({
1817
- run: "example-run",
1880
+ const result = await zapier.disableAgenticManagement({
1881
+ workflow: "example-workflow",
1818
1882
  });
1819
1883
  ```
1820
1884
 
1821
- #### `getWorkflowVersion` 🧪 _experimental_
1885
+ #### `disableWorkflow` 🧪 _experimental_
1822
1886
 
1823
- Get full details of a workflow version including source files
1887
+ Disable a durable workflow so it stops accepting triggers
1824
1888
 
1825
1889
  **Parameters:**
1826
1890
 
@@ -1828,1292 +1892,1246 @@ Get full details of a workflow version including source files
1828
1892
  | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
1829
1893
  | `options` | `object` | ✅ | — | — | |
1830
1894
  | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1831
- | ​ ↳ `version` | `string` | ✅ | — | — | Workflow version ID |
1832
1895
 
1833
- **Returns:** `Promise<WorkflowVersionItem>`
1896
+ **Returns:** `Promise<WorkflowItem>`
1834
1897
 
1835
- | Name | Type | Required | Possible Values | Description |
1836
- | ---------------------------- | -------- | -------- | --------------- | ------------------------------------------------------------------------------------ |
1837
- | `data` | `object` | ✅ | — | |
1838
- | ​ ↳ `id` | `string` | ✅ | — | Workflow version ID (UUID) |
1839
- | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
1840
- | ​ ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
1841
- | ​ ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this version's runs |
1842
- | ​ ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this version (or null) |
1843
- | ​ ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who published this version |
1844
- | ​ ↳ `created_at` | `string` | ✅ | — | When the version was published (ISO-8601) |
1845
- | ​ ↳ `trigger` | `object` | ✅ | — | Trigger configuration persisted on this version, or null for webhook-only workflows. |
1846
- | ​ ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this version (or null). |
1847
- | ​ ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this version (or null). |
1898
+ | Name | Type | Required | Possible Values | Description |
1899
+ | ------------- | --------- | -------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
1900
+ | `data` | `object` | ✅ | — | |
1901
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
1902
+ | ​ ↳ `enabled` | `boolean` | ✅ | — | Workflow's enabled state after the operation. Typically false; mirrors the row's true state in case a concurrent enable raced with this call. |
1848
1903
 
1849
1904
  **Example:**
1850
1905
 
1851
1906
  ```typescript
1852
- const { data: workflowVersion } = await zapier.getWorkflowVersion({
1907
+ const { data: workflow } = await zapier.disableWorkflow({
1853
1908
  workflow: "example-workflow",
1854
- version: "example-version",
1855
1909
  });
1856
1910
  ```
1857
1911
 
1858
- #### `importWorkflow` 🧪 _experimental_
1912
+ #### `discardWorkflowDraft` 🧪 _experimental_
1859
1913
 
1860
- Convert an existing Zap into a durable workflow. Transforms the Zap's latest published version (falling back to its draft only when the Zap has never been published) and puts the resulting source in an open draft. The workflow is created disabled with no published version, so publish the draft to make it live. The original Zap is untouched and keeps running.
1914
+ Discard an open workflow draft (soft delete). The draft's unpublished edits stop resolving; the published version is untouched.
1861
1915
 
1862
1916
  **Parameters:**
1863
1917
 
1864
- | Name | Type | Required | Default | Possible Values | Description |
1865
- | ------------- | --------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
1866
- | `options` | `object` | ✅ | — | — | |
1867
- | ​ ↳ `zap` | `string` | ✅ | — | — | ID of the Zap to import. Must be owned by the requesting user. Recorded on the created workflow as source_zap_id. |
1868
- | ​ ↳ `name` | `string` | ❌ | — | — | Name for the created workflow. Defaults to a kebab-cased form of the Zap's title, or "imported-workflow" when the Zap has no title. |
1869
- | ​ ↳ `private` | `boolean` | ❌ | — | — | Restrict the created workflow to the creating user. Defaults to false, which makes it account-visible. |
1918
+ | Name | Type | Required | Default | Possible Values | Description |
1919
+ | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
1920
+ | `options` | `object` | ✅ | — | — | |
1921
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1922
+ | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
1870
1923
 
1871
- **Returns:** `Promise<ImportWorkflowResponse>`
1924
+ **Returns:** `Promise<WorkflowDraftItem>`
1872
1925
 
1873
- | Name | Type | Required | Possible Values | Description |
1874
- | ------------------------------ | ---------- | -------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1875
- | `data` | `object` | ✅ | — | |
1876
- | ​ ↳ `workflow` | `object` | ✅ | — | The created workflow. Disabled, with no published version, and source_zap_id set to the imported Zap. |
1877
- | ​   ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
1878
- | ​   ↳ `name` | `string` | ✅ | — | Workflow name |
1879
- | ​   ↳ `description` | `string` | ❌ | — | Optional workflow description (null if unset) |
1880
- | ​   ↳ `trigger_url` | `string` | ✅ | — | Public URL that fires this workflow when POSTed to. Embeds a trigger token in the path — treat as sensitive. Requests must also be authenticated as the account. |
1881
- | ​   ↳ `editor_url` | `string` | ✅ | — | URL to the Zapier workflow editor for this workflow |
1882
- | ​   ↳ `enabled` | `boolean` | ✅ | — | Whether the workflow accepts triggers. An import always lands disabled. |
1883
- | ​   ↳ `disabled_reason` | `string` | ❌ | `trigger_claim_failed` | Why the workflow is off, when system-disabled. |
1884
- | ​   ↳ `is_private` | `boolean` | ✅ | — | Whether the workflow is private to the creating user. False means account-visible. |
1885
- | ​   ↳ `source_zap_id` | `string` | ❌ | — | The Zap this workflow was imported from. |
1886
- | ​   ↳ `created_by_user_id` | `string` | ✅ | — | |
1887
- | ​   ↳ `updated_by_user_id` | `string` | ❌ | — | |
1888
- | ​   ↳ `current_version_id` | `string` | ❌ | — | Null on a fresh import, which has no published version yet. |
1889
- | ​   ↳ `triggers[]` | `object[]` | ✅ | — | Empty on a fresh import, which has no published version yet. |
1890
- | ​     ↳ `selected_api` | `string` | ✅ | — | Zapier app/API identifier (e.g. 'GoogleSheetsAPI') |
1891
- | ​     ↳ `action` | `string` | ✅ | — | Trigger action key (e.g. 'new_row') |
1892
- | ​     ↳ `authentication_id` | `string` | ❌ | — | Connection ID for the trigger source. Null for no-auth triggers. |
1893
- | ​     ↳ `params` | `object` | ❌ | — | Trigger parameters as a JSON object |
1894
- | ​     ↳ `status` | `string` | ✅ | `unclaimed`, `pending`, `active`, `releasing`, `released`, `failed` | Live trigger claim status — whether the trigger is currently subscribed to its source. |
1895
- | ​     ↳ `error` | `string` | ❌ | — | Failure reason for the latest claim. Present (non-null) only when status is 'failed'. |
1896
- | ​     ↳ `details` | `object` | ❌ | — | Trigger-type-specific metadata; shape varies by trigger type (e.g. `webhook_url` on catch-hook triggers). Null or absent when none applies. |
1897
- | ​   ↳ `created_at` | `string` | ✅ | — | |
1898
- | ​   ↳ `updated_at` | `string` | ❌ | — | |
1899
- | ​ ↳ `draft` | `object` | ✅ | — | The open draft holding the transformed source. |
1900
- | ​   ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
1901
- | ​   ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
1902
- | ​   ↳ `slug` | `string` | ✅ | — | Human-friendly display name, not an identifier: two open drafts of a workflow may share one |
1903
- | ​   ↳ `base_version_id` | `string` | ✅ | — | The version this draft was forked from (the live version at draft creation), or null when the workflow had no published version yet |
1904
- | ​   ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
1905
- | ​   ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this draft |
1906
- | ​   ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this draft (or null) |
1907
- | ​   ↳ `draft_revision` | `number` | ✅ | — | Monotonic revision counter for optimistic concurrency. Echo it back on draft updates to detect concurrent edits. |
1908
- | ​   ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
1909
- | ​   ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who created (forked) this draft |
1910
- | ​   ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
1911
- | ​   ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
1912
- | ​   ↳ `discarded_at` | `string` | ✅ | — | When the draft was discarded (ISO-8601), or null while open |
1913
- | ​   ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
1914
- | ​   ↳ `updated_at` | `string` | ✅ | — | When the draft row was last updated (ISO-8601) |
1915
- | ​   ↳ `trigger` | `object` | ✅ | — | Trigger configuration held on this draft, or null for webhook-only workflows. |
1916
- | ​   ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this draft (or null). |
1917
- | ​   ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this draft (or null). |
1918
- | ​ ↳ `issues[]` | `object[]` | ✅ | — | Blocking and non-blocking translation issues from the transform, passed through unchanged. Blocking issues do not prevent draft creation; they must be resolved before the draft will publish. |
1919
- | ​   ↳ `line` | `number` | ✅ | — | 1-based line in the generated source the issue relates to, or 0 when not line-specific. |
1920
- | ​   ↳ `column` | `number` | ✅ | — | 1-based column, or 0 when not column-specific. |
1921
- | ​   ↳ `node_kind` | `string` | ✅ | — | Category of the issue, used to group and message them, e.g. "invalid-connection-id", "DelayStep", "app-version-conflict". |
1922
- | ​   ↳ `step_name` | `string` | ❌ | — | ZDL step id or name the issue originated from, when known. |
1923
- | ​   ↳ `message` | `string` | ✅ | — | Human-readable description of the issue. |
1924
- | ​   ↳ `blocking` | `boolean` | ✅ | — | Whether the issue must be resolved before the draft can be published. Computed server-side, so callers do not re-derive it. A blocking issue does not prevent the draft being created. |
1926
+ | Name | Type | Required | Possible Values | Description |
1927
+ | ---------------------------- | -------- | -------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
1928
+ | `data` | `object` | ✅ | — | |
1929
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
1930
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
1931
+ | ​ ↳ `slug` | `string` | ✅ | — | Human-friendly display name, not an identifier: two open drafts of a workflow may share one |
1932
+ | ​ ↳ `base_version_id` | `string` | ✅ | — | The version this draft was forked from (the live version at draft creation), or null when the workflow had no published version yet |
1933
+ | ​ ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
1934
+ | ​ ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this draft |
1935
+ | ​ ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this draft (or null) |
1936
+ | ​ ↳ `draft_revision` | `number` | ✅ | — | Monotonic revision counter for optimistic concurrency. Echo it back on draft updates to detect concurrent edits. |
1937
+ | ​ ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
1938
+ | ​ ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who created (forked) this draft |
1939
+ | ​ ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
1940
+ | ​ ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
1941
+ | ​ ↳ `discarded_at` | `string` | ✅ | — | When the draft was discarded (ISO-8601), or null while open |
1942
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
1943
+ | ​ ↳ `updated_at` | `string` | ✅ | — | When the draft row was last updated (ISO-8601) |
1944
+ | ​ ↳ `trigger` | `object` | ✅ | — | Trigger configuration held on this draft, or null for webhook-only workflows. |
1945
+ | ​ ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this draft (or null). |
1946
+ | ​ ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this draft (or null). |
1925
1947
 
1926
1948
  **Example:**
1927
1949
 
1928
1950
  ```typescript
1929
- const { data: workflow } = await zapier.importWorkflow({
1930
- zap: "example-zap",
1951
+ const result = await zapier.discardWorkflowDraft({
1952
+ workflow: "example-workflow",
1953
+ draft: "example-draft",
1931
1954
  });
1932
1955
  ```
1933
1956
 
1934
- #### `listDurableRuns` 🧪 _experimental_
1957
+ #### `enableAgenticManagement` 🧪 _experimental_
1935
1958
 
1936
- List run-once durable runs for the authenticated account, newest first
1959
+ Put one workflow under Agentic Management. A workflow disabled earlier comes back with the modes and auto-approve choice it had, unless you pass new ones here.
1937
1960
 
1938
1961
  **Parameters:**
1939
1962
 
1940
- | Name | Type | Required | Default | Possible Values | Description |
1941
- | -------------- | -------- | -------- | ------- | --------------- | ---------------------------------------------- |
1942
- | `options` | `object` | ✅ | — | — | |
1943
- | ​ ↳ `pageSize` | `number` | ❌ | — | — | Number of runs per page (max 100) |
1944
- | ​ ↳ `cursor` | `string` | ❌ | — | — | Pagination cursor |
1945
- | ​ ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
1963
+ | Name | Type | Required | Default | Possible Values | Description |
1964
+ | ----------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1965
+ | `options` | `object` | ✅ | — | — | |
1966
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to put under agentic management. |
1967
+ | ​ ↳ `modes` | `array` | ❌ | — | — | The modes to run for this workflow. Omit it and the workflow starts on `heal` alone. A mode is what Agentic Management watches for and what it changes in response. `heal` monitors runs for errors and, when something breaks, diagnoses the cause and drafts and tests a fix; it is the mode a workflow gets by default. `expand` grows what the workflow covers: it reviews runs that succeeded without actually doing anything — a lookup that matched nothing, a filter that passed no items, a trigger payload no branch handles — and proposes a new branch or step to handle that case, rather than rewriting the ones that already work. `harden` watches the AI steps: when an AI step keeps doing the same work the same way, it converts that step into fixed code, so the workflow runs faster, costs less, and behaves the same way every time. Modes stack — each one you name runs alongside the others, and a mode you leave out does nothing, so a workflow on `expand` alone does not repair failed runs. Whether a change goes live on its own or waits for someone to approve it is `autoApprove`, not the mode. |
1968
+ | ​ ↳ `autoApprove` | `boolean` | ❌ | — | — | Apply the fixes Agentic Management proposes without asking first. Set it to false and each fix waits for someone to approve it. Omit it and fixes are applied without asking, which is what a workflow enabled for the first time gets; a workflow being re-enabled keeps the setting it had before. |
1946
1969
 
1947
- **Returns:** `Promise<PaginatedResult<DurableRunItem>>`
1970
+ **Returns:** `Promise<AgenticManagementEnableResultItem>`
1948
1971
 
1949
- | Name | Type | Required | Possible Values | Description |
1950
- | ------------------ | ---------- | -------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
1951
- | `data[]` | `object[]` | ✅ | — | |
1952
- | ​ ↳ `id` | `string` | ✅ | — | Run ID (UUID) |
1953
- | ​ ↳ `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
1954
- | ​ ↳ `input` | `unknown` | ✅ | — | Input data passed to the run |
1955
- | ​ ↳ `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
1956
- | ​ ↳ `error` | `object` | ✅ | — | Structured error details when the run failed (null otherwise) |
1957
- | ​ ↳ `execution_id` | `string` | ✅ | — | Linked execution ID. Null until the run leaves the `initialized` state. |
1958
- | ​ ↳ `is_private` | `boolean` | ✅ | — | When true, the run is visible only to the creating user; otherwise visible across the account. |
1959
- | ​ ↳ `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
1960
- | ​ ↳ `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
1961
- | `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
1972
+ | Name | Type | Required | Possible Values | Description |
1973
+ | ---------------- | -------- | -------- | --------------- | ----------------------------------------------------------------------- |
1974
+ | `data` | `object` | ✅ | — | |
1975
+ | ​ ↳ `manager_id` | `string` | ✅ | — | ID of the manager automation Zapier provisioned to watch this workflow. |
1962
1976
 
1963
1977
  **Example:**
1964
1978
 
1965
1979
  ```typescript
1966
- // Get first page and a cursor for the second page
1967
- const { data: durableRuns, nextCursor } = await zapier.listDurableRuns();
1968
-
1969
- // Or iterate over all pages
1970
- for await (const page of zapier.listDurableRuns().pages()) {
1971
- // Do something with each page
1972
- }
1973
-
1974
- // Or iterate over individual items across all pages
1975
- for await (const durableRun of zapier.listDurableRuns().items()) {
1976
- // Do something with each durableRun
1977
- }
1980
+ const { data: agenticManagementEnableResult } =
1981
+ await zapier.enableAgenticManagement({
1982
+ workflow: "example-workflow",
1983
+ });
1978
1984
  ```
1979
1985
 
1980
- #### `listWorkflowDrafts` 🧪 _experimental_
1986
+ #### `enableWorkflow` 🧪 _experimental_
1981
1987
 
1982
- List drafts for a workflow, most recently edited first (open drafts by default)
1988
+ Enable a durable workflow so it accepts triggers
1983
1989
 
1984
1990
  **Parameters:**
1985
1991
 
1986
- | Name | Type | Required | Default | Possible Values | Description |
1987
- | -------------- | -------- | -------- | ------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1988
- | `options` | `object` | ✅ | — | — | |
1989
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1990
- | ​ ↳ `status` | `string` | ❌ | — | `open`, `discarded` | Filter by draft status (server default: open) |
1991
- | ​ ↳ `slug` | `string` | ❌ | — | — | Filter by exact slug match. Slugs are not unique, so this returns every draft with this slug matching the selected status, ordered by most recent activity and paginated |
1992
- | ​ ↳ `pageSize` | `number` | ❌ | — | — | Number of drafts per page (max 100) |
1993
- | ​ ↳ `cursor` | `string` | ❌ | — | — | Pagination cursor |
1994
- | ​ ↳ `maxItems` | `number` | ❌ | — | — | Maximum total drafts to return across all pages |
1992
+ | Name | Type | Required | Default | Possible Values | Description |
1993
+ | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
1994
+ | `options` | `object` | ✅ | — | — | |
1995
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
1995
1996
 
1996
- **Returns:** `Promise<PaginatedResult<WorkflowDraftItem>>`
1997
+ **Returns:** `Promise<WorkflowItem>`
1997
1998
 
1998
- | Name | Type | Required | Possible Values | Description |
1999
- | ---------------------------- | ---------- | -------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
2000
- | `data[]` | `object[]` | ✅ | — | |
2001
- | ​ ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
2002
- | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2003
- | ​ ↳ `slug` | `string` | ✅ | — | Human-friendly display name, not an identifier: two open drafts of a workflow may share one |
2004
- | ​ ↳ `base_version_id` | `string` | ✅ | — | The version this draft was forked from (the live version at draft creation), or null when the workflow had no published version yet |
2005
- | ​ ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
2006
- | ​ ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
2007
- | ​ ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
2008
- | ​ ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
2009
- | `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
1999
+ | Name | Type | Required | Possible Values | Description |
2000
+ | ------------- | --------- | -------- | --------------- | ---------------------------------------------------------- |
2001
+ | `data` | `object` | ✅ | — | |
2002
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
2003
+ | ​ ↳ `enabled` | `boolean` | ✅ | — | Workflow's enabled state after the operation (always true) |
2010
2004
 
2011
2005
  **Example:**
2012
2006
 
2013
2007
  ```typescript
2014
- // Get first page and a cursor for the second page
2015
- const { data: workflowDrafts, nextCursor } = await zapier.listWorkflowDrafts({
2008
+ const { data: workflow } = await zapier.enableWorkflow({
2016
2009
  workflow: "example-workflow",
2017
2010
  });
2018
-
2019
- // Or iterate over all pages
2020
- for await (const page of zapier
2021
- .listWorkflowDrafts({
2022
- workflow: "example-workflow",
2023
- })
2024
- .pages()) {
2025
- // Do something with each page
2026
- }
2027
-
2028
- // Or iterate over individual items across all pages
2029
- for await (const workflowDraft of zapier
2030
- .listWorkflowDrafts({
2031
- workflow: "example-workflow",
2032
- })
2033
- .items()) {
2034
- // Do something with each workflowDraft
2035
- }
2036
2011
  ```
2037
2012
 
2038
- #### `listWorkflowRuns` 🧪 _experimental_
2013
+ #### `getAgenticManagementConfig` 🧪 _experimental_
2039
2014
 
2040
- List workflow runs for a specific workflow, newest first. Live runs (of published versions) and draft runs share the one list; pass `kind` to narrow it to one.
2015
+ Read the Agentic Management config for one workflow.
2041
2016
 
2042
2017
  **Parameters:**
2043
2018
 
2044
- | Name | Type | Required | Default | Possible Values | Description |
2045
- | -------------- | -------- | -------- | ------- | --------------- | --------------------------------------------------------------------- |
2046
- | `options` | `object` | ✅ | — | — | |
2047
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2048
- | ​ ↳ `pageSize` | `number` | ❌ | — | — | Number of runs per page (max 100) |
2049
- | ​ ↳ `kind` | `string` | ❌ | — | `live`, `draft` | Return only runs of this kind. Omit for both, interleaved by recency. |
2050
- | ​ ↳ `cursor` | `string` | ❌ | — | — | Pagination cursor |
2051
- | ​ ↳ `maxItems` | `number` | ❌ | — | — | Maximum total runs to return across all pages |
2052
-
2053
- **Returns:** `Promise<PaginatedResult<WorkflowRunItem>>`
2054
-
2055
- | Name | Type | Required | Possible Values | Description |
2056
- | ------------ | ---------- | -------- | --------------- | -------------------------------------------------------------- |
2057
- | `data[]` | `object[]` | ✅ | — | One of the variants below, distinguished by `kind` |
2058
- | `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
2059
-
2060
- **When `kind` is `"live"`:**
2061
-
2062
- | Name | Type | Required | Possible Values | Description |
2063
- | --------------------- | --------- | -------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- |
2064
- | `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
2065
- | `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
2066
- | `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
2067
- | `input` | `unknown` | ✅ | — | Input passed to the run |
2068
- | `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
2069
- | `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
2070
- | `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
2071
- | `kind` | `string` | ✅ | `live` | A run of a published workflow version. |
2072
- | `trigger_id` | `string` | ✅ | — | ID of the trigger that fired this run. Null for runs created without a trigger. |
2073
- | `workflow_version_id` | `string` | ✅ | — | Workflow version the run is bound to. Null in rare edge cases. |
2019
+ | Name | Type | Required | Default | Possible Values | Description |
2020
+ | -------------- | -------- | -------- | ------- | --------------- | --------------------------- |
2021
+ | `options` | `object` | ✅ | — | — | |
2022
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to read. |
2074
2023
 
2075
- **When `kind` is `"draft"`:**
2024
+ **Returns:** `Promise<AgenticManagementConfigItem>`
2076
2025
 
2077
- | Name | Type | Required | Possible Values | Description |
2078
- | ------------------- | --------- | -------- | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
2079
- | `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
2080
- | `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
2081
- | `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
2082
- | `input` | `unknown` | ✅ | — | Input passed to the run |
2083
- | `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
2084
- | `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
2085
- | `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
2086
- | `kind` | `string` | ✅ | `draft` | A run launched from a workflow draft via `runWorkflowDraft`. |
2087
- | `workflow_draft_id` | `string` | ✅ | — | The draft this run was launched from. Null once that draft has been deleted (the run outlives its draft). |
2088
- | `draft_revision` | `number` | ✅ | — | The draft's revision at the moment this run was created. |
2026
+ | Name | Type | Required | Possible Values | Description |
2027
+ | ------------------ | --------- | -------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2028
+ | `data` | `object` | ✅ | — | |
2029
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow this config describes. |
2030
+ | ​ ↳ `enabled` | `boolean` | ✅ | — | Whether Agentic Management is currently active for this workflow. |
2031
+ | ​ ↳ `auto_approve` | `boolean` | ✅ | — | Whether fixes are applied without asking for approval first. `false` when Agentic Management has never been set up for this workflow. |
2032
+ | ​ ↳ `modes` | `array` | ✅ | — | The modes the workflow runs. Still listed while `enabled` is false, because the settings are kept for a later re-enable — so read `enabled` to tell whether they are in effect, not this list. |
2033
+ | ​ ↳ `manager_id` | `string` | ❌ | — | ID of the manager automation Zapier provisioned for this workflow, once one exists; `null` otherwise. Use it to link to that automation to see the runs it has taken. |
2089
2034
 
2090
2035
  **Example:**
2091
2036
 
2092
2037
  ```typescript
2093
- // Get first page and a cursor for the second page
2094
- const { data: workflowRuns, nextCursor } = await zapier.listWorkflowRuns({
2095
- workflow: "example-workflow",
2096
- });
2097
-
2098
- // Or iterate over all pages
2099
- for await (const page of zapier
2100
- .listWorkflowRuns({
2101
- workflow: "example-workflow",
2102
- })
2103
- .pages()) {
2104
- // Do something with each page
2105
- }
2106
-
2107
- // Or iterate over individual items across all pages
2108
- for await (const workflowRun of zapier
2109
- .listWorkflowRuns({
2038
+ const { data: agenticManagementConfig } =
2039
+ await zapier.getAgenticManagementConfig({
2110
2040
  workflow: "example-workflow",
2111
- })
2112
- .items()) {
2113
- // Do something with each workflowRun
2114
- }
2041
+ });
2115
2042
  ```
2116
2043
 
2117
- #### `listWorkflowVersions` 🧪 _experimental_
2044
+ #### `getAgenticManagementIntent` 🧪 _experimental_
2118
2045
 
2119
- List published versions for a workflow, newest first
2046
+ Read the intent recorded for one workflow version: the plain-language description of what that version of the workflow is meant to do.
2120
2047
 
2121
2048
  **Parameters:**
2122
2049
 
2123
- | Name | Type | Required | Default | Possible Values | Description |
2124
- | -------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------- |
2125
- | `options` | `object` | ✅ | — | — | |
2126
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2127
- | ​ ↳ `pageSize` | `number` | ❌ | — | — | Number of versions per page (max 100) |
2128
- | ​ ↳ `cursor` | `string` | ❌ | — | — | Pagination cursor |
2129
- | ​ ↳ `maxItems` | `number` | ❌ | — | — | Maximum total versions to return across all pages |
2050
+ | Name | Type | Required | Default | Possible Values | Description |
2051
+ | -------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2052
+ | `options` | `object` | ✅ | — | — | |
2053
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to read. |
2054
+ | ​ ↳ `version` | `string` | ❌ | — | — | The workflow version the intent belongs to. Each version stores its own intent, and a version never picks up the intent of another, so publishing a new version starts it with none. Omit this to use the workflow's current published version. |
2130
2055
 
2131
- **Returns:** `Promise<PaginatedResult<WorkflowVersionItem>>`
2056
+ **Returns:** `Promise<AgenticManagementIntentItem>`
2132
2057
 
2133
- | Name | Type | Required | Possible Values | Description |
2134
- | ---------------------------- | ---------- | -------- | --------------- | ------------------------------------------------------------------------------------ |
2135
- | `data[]` | `object[]` | ✅ | — | |
2136
- | ​ ↳ `id` | `string` | ✅ | — | Workflow version ID (UUID) |
2137
- | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2138
- | ​ ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this version's runs |
2139
- | ​ ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this version (or null) |
2140
- | ​ ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who published this version |
2141
- | ​ ↳ `created_at` | `string` | ✅ | — | When the version was published (ISO-8601) |
2142
- | ​ ↳ `trigger` | `object` | ✅ | — | Trigger configuration persisted on this version, or null for webhook-only workflows. |
2143
- | ​ ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this version (or null). |
2144
- | ​ ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this version (or null). |
2145
- | `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
2058
+ | Name | Type | Required | Possible Values | Description |
2059
+ | ------------------------- | -------- | -------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2060
+ | `data` | `object` | ✅ | — | |
2061
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow the intent belongs to. |
2062
+ | ​ ↳ `workflow_version_id` | `string` | ✅ | — | The version this read or write actually landed on, so you can tell which one answered when you omitted `version`. `null` only when you read a workflow that has nothing published yet. |
2063
+ | ​ ↳ `intent` | `string` | ✅ | — | The intent stored for this version, or `null` when this version has none. Intent is never carried over from another version. |
2064
+ | ​ ↳ `updated_at` | `string` | ❌ | — | When the intent was last written; `null` when never captured. |
2146
2065
 
2147
2066
  **Example:**
2148
2067
 
2149
2068
  ```typescript
2150
- // Get first page and a cursor for the second page
2151
- const { data: workflowVersions, nextCursor } =
2152
- await zapier.listWorkflowVersions({
2069
+ const { data: agenticManagementIntent } =
2070
+ await zapier.getAgenticManagementIntent({
2153
2071
  workflow: "example-workflow",
2154
2072
  });
2155
-
2156
- // Or iterate over all pages
2157
- for await (const page of zapier
2158
- .listWorkflowVersions({
2159
- workflow: "example-workflow",
2160
- })
2161
- .pages()) {
2162
- // Do something with each page
2163
- }
2164
-
2165
- // Or iterate over individual items across all pages
2166
- for await (const workflowVersion of zapier
2167
- .listWorkflowVersions({
2168
- workflow: "example-workflow",
2169
- })
2170
- .items()) {
2171
- // Do something with each workflowVersion
2172
- }
2173
2073
  ```
2174
2074
 
2175
- #### `listWorkflows` 🧪 _experimental_
2075
+ #### `getDurableRun` 🧪 _experimental_
2176
2076
 
2177
- List all active durable workflows for the authenticated account
2077
+ Get the full state of a run-once durable run, including its operations journal
2178
2078
 
2179
2079
  **Parameters:**
2180
2080
 
2181
- | Name | Type | Required | Default | Possible Values | Description |
2182
- | -------------- | -------- | -------- | ------- | --------------- | -------------------------------------------------- |
2183
- | `options` | `object` | ✅ | — | — | |
2184
- | ​ ↳ `pageSize` | `number` | ❌ | — | — | Number of workflows per page (max 100) |
2185
- | ​ ↳ `maxItems` | `number` | ❌ | — | — | Maximum total workflows to return across all pages |
2186
- | ​ ↳ `cursor` | `string` | ❌ | — | — | Cursor to start from for pagination |
2081
+ | Name | Type | Required | Default | Possible Values | Description |
2082
+ | --------- | -------- | -------- | ------- | --------------- | -------------- |
2083
+ | `options` | `object` | ✅ | — | — | |
2084
+ | ​ ↳ `run` | `string` | ✅ | — | — | Durable run ID |
2187
2085
 
2188
- **Returns:** `Promise<PaginatedResult<WorkflowItem>>`
2086
+ **Returns:** `Promise<DurableRunItem>`
2189
2087
 
2190
- | Name | Type | Required | Possible Values | Description |
2191
- | ------------------------- | ---------- | -------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2192
- | `data[]` | `object[]` | ✅ | — | |
2193
- | ​ ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
2194
- | ​ ↳ `name` | `string` | ✅ | — | Workflow name |
2195
- | ​ ↳ `description` | `string` | ✅ | — | Optional workflow description (null if unset) |
2196
- | ​ ↳ `trigger_url` | `string` | ✅ | — | Public URL that fires this workflow when POSTed to. Embeds a trigger token in the path — treat as sensitive. Requests must also be authenticated as the account. |
2197
- | ​ ↳ `editor_url` | `string` | ✅ | — | URL to the Zapier workflow editor for this workflow |
2198
- | ​ ↳ `enabled` | `boolean` | ✅ | — | Whether the workflow currently accepts triggers |
2199
- | ​ ↳ `disabled_reason` | `string` | ❌ | `trigger_claim_failed` | Why the workflow is off, when system-disabled. Null when not system-disabled. |
2200
- | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the workflow is private to the creating user. False means account-visible. |
2201
- | ​ ↳ `created_by_user_id` | `string` | ✅ | — | User ID of the workflow creator (null in legacy data) |
2202
- | ​ ↳ `current_version_id` | `string` | ✅ | — | ID of the workflow version that runs handle. Null until a version is published. |
2203
- | ​ ↳ `triggers[]` | `object[]` | ✅ | — | Trigger configurations from the current version, with live claim status. Empty array when the workflow has no triggers. |
2204
- | ​   ↳ `selected_api` | `string` | ✅ | — | Zapier app/API identifier (e.g. 'GoogleSheetsAPI') |
2205
- | ​   ↳ `action` | `string` | ✅ | — | Trigger action key (e.g. 'new_row') |
2206
- | ​   ↳ `authentication_id` | `string` | ❌ | — | Connection ID for the trigger source. Null for no-auth triggers. |
2207
- | ​   ↳ `params` | `object` | ❌ | — | Trigger parameters as a JSON object |
2208
- | ​   ↳ `status` | `string` | ✅ | `unclaimed`, `pending`, `active`, `releasing`, `released`, `failed` | Live trigger claim status — whether the trigger is currently subscribed to its source. |
2209
- | ​   ↳ `error` | `string` | ❌ | — | Failure reason for the latest claim. Present (non-null) only when status is 'failed'. |
2210
- | ​   ↳ `details` | `object` | ❌ | — | Trigger-type-specific metadata; shape varies by trigger type (e.g. `webhook_url` on catch-hook triggers). Null or absent when none applies. |
2211
- | ​ ↳ `created_at` | `string` | ✅ | — | When the workflow was created (ISO-8601) |
2212
- | ​ ↳ `updated_at` | `string` | ✅ | — | When the workflow was last modified (ISO-8601) |
2213
- | `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
2088
+ | Name | Type | Required | Possible Values | Description |
2089
+ | ---------------- | --------- | -------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
2090
+ | `data` | `object` | ✅ | — | |
2091
+ | ​ ↳ `id` | `string` | ✅ | — | Run ID (UUID) |
2092
+ | ​ ↳ `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
2093
+ | ​ ↳ `input` | `unknown` | ✅ | — | Input data passed to the run |
2094
+ | ​ ↳ `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
2095
+ | ​ ↳ `error` | `object` | ✅ | — | Structured error details when the run failed (null otherwise) |
2096
+ | ​ ↳ `execution` | `object` | ✅ | — | Linked execution, including the operations journal. Null while the run is still in `initialized` state. |
2097
+ | ​ ↳ `is_private` | `boolean` | ✅ | — | When true, the run is visible only to the creating user; otherwise visible across the account. |
2098
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
2099
+ | ​ ↳ `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
2214
2100
 
2215
2101
  **Example:**
2216
2102
 
2217
2103
  ```typescript
2218
- // Get first page and a cursor for the second page
2219
- const { data: workflows, nextCursor } = await zapier.listWorkflows();
2104
+ const { data: durableRun } = await zapier.getDurableRun({
2105
+ run: "example-run",
2106
+ });
2107
+ ```
2220
2108
 
2221
- // Or iterate over all pages
2222
- for await (const page of zapier.listWorkflows().pages()) {
2223
- // Do something with each page
2224
- }
2109
+ #### `getTriggerRun` 🧪 _experimental_
2225
2110
 
2226
- // Or iterate over individual items across all pages
2227
- for await (const workflow of zapier.listWorkflows().items()) {
2228
- // Do something with each workflow
2229
- }
2230
- ```
2231
-
2232
- #### `publishWorkflowDraft` 🧪 _experimental_
2233
-
2234
- Publish an open draft as a new immutable workflow version. Advances the workflow's live pointer and discards the draft — publish consumes it, so an open draft always means unpublished work. Continue editing by creating a new draft, which forks from the just-published version.
2111
+ Get the workflow run associated with a deployed workflow's trigger. Useful immediately after firing a trigger, when you have the trigger ID but not yet the run ID.
2235
2112
 
2236
2113
  **Parameters:**
2237
2114
 
2238
- | Name | Type | Required | Default | Possible Values | Description |
2239
- | ------------------- | --------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2240
- | `options` | `object` | ✅ | — | — | |
2241
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2242
- | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
2243
- | ​ ↳ `enabled` | `boolean` | ❌ | — | — | Set the workflow's enabled state as part of the publish. If omitted, the current enabled state is preserved. |
2244
- | ​ ↳ `draftRevision` | `number` | ❌ | — | — | Expected draft revision for optimistic concurrency. Pass the revision from the last read; the server rejects the publish with a conflict if the draft has changed since. Omit to skip the check. |
2245
- | ​ ↳ `manual` | `boolean` | ❌ | — | — | Declare this publish on-demand and triggerless, overriding the draft's stored intent for this publish only. Pass `manual: true` only when the draft has no trigger configured; the API rejects a draft with a trigger published as `manual: true` as a contradiction (400). |
2115
+ | Name | Type | Required | Default | Possible Values | Description |
2116
+ | ------------- | -------- | -------- | ------- | --------------- | ------------------- |
2117
+ | `options` | `object` | ✅ | — | — | |
2118
+ | ​ ↳ `trigger` | `string` | ✅ | — | — | Workflow trigger ID |
2246
2119
 
2247
- **Returns:** `Promise<PublishWorkflowDraftResponse>`
2120
+ **Returns:** `Promise<WorkflowRunItem>`
2248
2121
 
2249
- | Name | Type | Required | Possible Values | Description |
2250
- | ------------------------------ | -------- | -------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
2251
- | `data` | `object` | ✅ | — | |
2252
- | ​ ↳ `draft` | `object` | ✅ | — | The consumed draft: status is 'discarded' and discarded_at is set. base_version_id still records the version the draft was forked from. |
2253
- | ​   ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
2254
- | ​   ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2255
- | ​   ↳ `slug` | `string` | ✅ | — | Human-friendly display name, not an identifier: two open drafts of a workflow may share one |
2256
- | ​   ↳ `base_version_id` | `string` | ✅ | — | The version this draft was forked from (the live version at draft creation), or null when the workflow had no published version yet |
2257
- | ​   ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
2258
- | ​   ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this draft |
2259
- | ​   ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this draft (or null) |
2260
- | ​   ↳ `draft_revision` | `number` | ✅ | — | Monotonic revision counter for optimistic concurrency. Echo it back on draft updates to detect concurrent edits. |
2261
- | ​   ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
2262
- | ​   ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who created (forked) this draft |
2263
- | ​   ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
2264
- | ​   ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
2265
- | ​   ↳ `discarded_at` | `string` | ✅ | — | When the draft was discarded (ISO-8601), or null while open |
2266
- | ​   ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
2267
- | ​   ↳ `updated_at` | `string` | ✅ | — | When the draft row was last updated (ISO-8601) |
2268
- | ​   ↳ `trigger` | `object` | ✅ | — | Trigger configuration held on this draft, or null for webhook-only workflows. |
2269
- | ​   ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this draft (or null). |
2270
- | ​   ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this draft (or null). |
2271
- | ​ ↳ `version` | `object` | ✅ | — | The newly published immutable workflow version, now live. |
2272
- | ​   ↳ `id` | `string` | ✅ | — | Workflow version ID (UUID) |
2273
- | ​   ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2274
- | ​   ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
2275
- | ​   ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this version's runs |
2276
- | ​   ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this version (or null) |
2277
- | ​   ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who published this version |
2278
- | ​   ↳ `created_at` | `string` | ✅ | — | When the version was published (ISO-8601) |
2279
- | ​   ↳ `trigger` | `object` | ✅ | — | Trigger configuration persisted on this version, or null for webhook-only workflows. |
2280
- | ​   ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this version (or null). |
2281
- | ​   ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this version (or null). |
2122
+ | Name | Type | Required | Possible Values | Description |
2123
+ | ------------------------- | --------- | -------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- |
2124
+ | `data` | `object` | ✅ | — | |
2125
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow run ID (UUID) |
2126
+ | ​ ↳ `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
2127
+ | ​ ↳ `workflow_version_id` | `string` | ✅ | — | Workflow version the run is bound to |
2128
+ | ​ ↳ `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
2129
+ | ​ ↳ `input` | `unknown` | ✅ | — | Input passed to the run |
2130
+ | ​ ↳ `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
2131
+ | ​ ↳ `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
2132
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
2133
+ | ​ ↳ `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
2282
2134
 
2283
2135
  **Example:**
2284
2136
 
2285
2137
  ```typescript
2286
- const { data: workflowVersion } = await zapier.publishWorkflowDraft({
2287
- workflow: "example-workflow",
2288
- draft: "example-draft",
2138
+ const { data: workflowRun } = await zapier.getTriggerRun({
2139
+ trigger: "example-trigger",
2289
2140
  });
2290
2141
  ```
2291
2142
 
2292
- #### `publishWorkflowVersion` 🧪 _experimental_
2143
+ #### `getWorkflow` 🧪 _experimental_
2293
2144
 
2294
- Publish a new version of a durable workflow. Enables the workflow by default.
2145
+ Get a durable workflow with its current version details and trigger claim status
2295
2146
 
2296
2147
  **Parameters:**
2297
2148
 
2298
- | Name | Type | Required | Default | Possible Values | Description |
2299
- | -------------------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2300
- | `options` | `object` | ✅ | — | — | |
2301
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2302
- | ​ ↳ `sourceFiles` | `object` | ✅ | — | — | Source files keyed by filename → contents |
2303
- | ​ ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies. A version of "latest" is resolved by the server for @zapier/zapier-durable and @zapier/zapier-sdk only; every other value, including a "latest" on any other package, is passed to the install as written. |
2304
- | ​ ↳ `zapierDurableVersion` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"), or "latest". Defaults to the server-configured version if omitted. "latest" is resolved by the server to the newest release old enough to clear the sandbox install age gate (24h) -- this is not npm's "latest" tag, which can point at a release too new to install. Ranges (^1.2.3, ~1.2) are rejected. |
2305
- | ​ ↳ `enabled` | `boolean` | ❌ | — | — | Enable the workflow after publishing. Defaults to true if omitted; pass false to publish without enabling. |
2306
- | ​ ↳ `ignoreOpenDrafts` | `boolean` | ❌ | — | — | Publish even though the workflow has open draft(s). Without this, the API rejects a direct publish with a 409 while any draft is open, since publishing the draft later would ship its stale content over this version. |
2307
- | ​ ↳ `connections` | `object` | ❌ | — | — | Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding. |
2308
- | ​ ↳ `appVersions` | `object` | ❌ | — | — | Map of app keys to pinned app implementation/version used by the workflow. Pass `null` to clear an existing binding. |
2309
- | ​ ↳ `trigger` | `object` | ❌ | — | — | Trigger configuration. When provided, the workflow subscribes to a Zapier trigger; for an on-demand, triggerless workflow, omit this and pass `manual: true` instead. |
2310
- | ​   ↳ `selectedApi` | `string` | ❌ | — | — | Zapier app/API identifier (e.g. 'GoogleSheetsAPI'). Required when a trigger is configured. |
2311
- | ​   ↳ `action` | `string` | ✅ | — | — | Trigger action key (e.g. 'new_row') |
2312
- | ​   ↳ `authenticationId` | `string` | ❌ | — | — | Connection ID for the trigger source. Omit or pass null for no-auth triggers (e.g. Schedule by Zapier). |
2313
- | ​   ↳ `params` | `object` | ❌ | — | — | Trigger parameters as a JSON object |
2314
- | ​ ↳ `manual` | `boolean` | ❌ | — | — | Declare this an on-demand, triggerless workflow version. Pass `manual: true` only when omitting `trigger`; passing both is a contradiction the API rejects with a 400. |
2149
+ | Name | Type | Required | Default | Possible Values | Description |
2150
+ | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
2151
+ | `options` | `object` | ✅ | — | — | |
2152
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2315
2153
 
2316
- **Returns:** `Promise<WorkflowVersionItem>`
2154
+ **Returns:** `Promise<WorkflowItem>`
2317
2155
 
2318
- | Name | Type | Required | Possible Values | Description |
2319
- | ---------------------------- | -------- | -------- | --------------- | ------------------------------------------------------------------------------------ |
2320
- | `data` | `object` | ✅ | — | |
2321
- | ​ ↳ `id` | `string` | ✅ | — | Workflow version ID (UUID) |
2322
- | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2323
- | ​ ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
2324
- | ​ ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this version's runs |
2325
- | ​ ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this version (or null) |
2326
- | ​ ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who published this version |
2327
- | ​ ↳ `created_at` | `string` | ✅ | — | When the version was published (ISO-8601) |
2328
- | ​ ↳ `trigger` | `object` | ✅ | — | Trigger configuration persisted on this version, or null for webhook-only workflows. |
2329
- | ​ ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this version (or null). |
2330
- | ​ ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this version (or null). |
2156
+ | Name | Type | Required | Possible Values | Description |
2157
+ | ------------------------------ | ---------- | -------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2158
+ | `data` | `object` | ✅ | — | |
2159
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
2160
+ | ​ ↳ `name` | `string` | ✅ | — | Workflow name |
2161
+ | ​ ↳ `description` | `string` | ✅ | — | Optional workflow description (null if unset) |
2162
+ | ​ ↳ `trigger_url` | `string` | ✅ | — | Public URL that fires this workflow when POSTed to. Embeds a trigger token in the path — treat as sensitive. Requests must also be authenticated as the account. |
2163
+ | ​ ↳ `editor_url` | `string` | ✅ | — | URL to the Zapier workflow editor for this workflow |
2164
+ | ​ ↳ `enabled` | `boolean` | ✅ | — | Whether the workflow currently accepts triggers |
2165
+ | ​ ↳ `disabled_reason` | `string` | ❌ | `trigger_claim_failed` | Why the workflow is off, when system-disabled. Null when not system-disabled. Independent of per-trigger claim status: an enabled workflow can still have a failed trigger. |
2166
+ | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the workflow is private to the creating user. False means account-visible. |
2167
+ | ​ ↳ `created_by_user_id` | `string` | ✅ | — | User ID of the workflow creator (null in legacy data) |
2168
+ | ​ ↳ `current_version` | `object` | ❌ | — | The currently published version, if any. Absent for workflows with no version published yet. |
2169
+ | ​   ↳ `id` | `string` | ✅ | — | Workflow version ID (UUID) |
2170
+ | ​   ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID |
2171
+ | ​   ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
2172
+ | ​   ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this version's runs |
2173
+ | ​   ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this version (or null) |
2174
+ | ​   ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who published this version |
2175
+ | ​   ↳ `created_at` | `string` | ✅ | — | When the version was published (ISO-8601) |
2176
+ | ​   ↳ `trigger` | `object` | ✅ | — | Trigger configuration persisted on this version, or null for webhook-only workflows. |
2177
+ | ​   ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this version (or null). |
2178
+ | ​   ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this version (or null). |
2179
+ | ​ ↳ `triggers[]` | `object[]` | ✅ | — | Trigger configurations from the current version, with live claim status. Empty array when the workflow has no triggers. |
2180
+ | ​   ↳ `selected_api` | `string` | ✅ | — | Zapier app/API identifier (e.g. 'GoogleSheetsAPI') |
2181
+ | ​   ↳ `action` | `string` | ✅ | — | Trigger action key (e.g. 'new_row') |
2182
+ | ​   ↳ `authentication_id` | `string` | ❌ | — | Connection ID for the trigger source. Null for no-auth triggers. |
2183
+ | ​   ↳ `params` | `object` | ❌ | — | Trigger parameters as a JSON object |
2184
+ | ​   ↳ `status` | `string` | ✅ | `unclaimed`, `pending`, `active`, `releasing`, `released`, `failed` | Live trigger claim status — whether the trigger is currently subscribed to its source. |
2185
+ | ​   ↳ `error` | `string` | ❌ | — | Failure reason for the latest claim. Present (non-null) only when status is 'failed'. |
2186
+ | ​   ↳ `details` | `object` | ❌ | — | Trigger-type-specific metadata; shape varies by trigger type (e.g. `webhook_url` on catch-hook triggers). Null or absent when none applies. |
2187
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the workflow was created (ISO-8601) |
2188
+ | ​ ↳ `updated_at` | `string` | ✅ | — | When the workflow was last modified (ISO-8601) |
2331
2189
 
2332
2190
  **Example:**
2333
2191
 
2334
2192
  ```typescript
2335
- const { data: workflowVersion } = await zapier.publishWorkflowVersion({
2193
+ const { data: workflow } = await zapier.getWorkflow({
2336
2194
  workflow: "example-workflow",
2337
- sourceFiles: {},
2338
2195
  });
2339
2196
  ```
2340
2197
 
2341
- #### `runDurable` 🧪 _experimental_
2198
+ #### `getWorkflowDraft` 🧪 _experimental_
2342
2199
 
2343
- Run a workflow's complete source-files map as a run-once durable run on code-substrate-runner (no deployed workflow required). Send every file the workflow needs, not only its entry point. Returns the run ID immediately; poll via getDurableRun for terminal status.
2200
+ Get full details of a workflow draft including source files
2344
2201
 
2345
2202
  **Parameters:**
2346
2203
 
2347
- | Name | Type | Required | Default | Possible Values | Description |
2348
- | -------------------------- | ---------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2349
- | `options` | `object` | ✅ | — | — | |
2350
- | ​ ↳ `sourceFiles` | `object` | ✅ | — | — | Source files keyed by filename → contents |
2351
- | ​ ↳ `input` | `unknown` | ❌ | — | — | Input data passed to the run. Accepts any JSON value, or its JSON-string encoding. |
2352
- | ​ ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies. A version of "latest" is resolved by the server for @zapier/zapier-durable and @zapier/zapier-sdk only; every other value, including a "latest" on any other package, is passed to the install as written. |
2353
- | ​ ↳ `zapierDurableVersion` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"), or "latest". Defaults to the server-configured version if omitted. "latest" is resolved by the server to the newest release old enough to clear the sandbox install age gate (24h) -- this is not npm's "latest" tag, which can point at a release too new to install. Ranges (^1.2.3, ~1.2) are rejected. |
2354
- | ​ ↳ `connections` | `object` | ❌ | — | — | Named connection aliases. Maps each alias to an object holding its Zapier connection ID, e.g. `{ "slack": { "connectionId": "123" } }`. |
2355
- | ​ ↳ `appVersions` | `object` | ❌ | — | — | Pinned app versions. Maps app keys (slugs) to implementation names and versions. |
2356
- | ​ ↳ `private` | `boolean` | ❌ | — | — | Only the creating user can see the run (default false) |
2357
- | ​ ↳ `notifications[]` | `object[]` | ❌ | — | — | Webhook subscribers for run lifecycle events. Each entry specifies a URL and the events it subscribes to. |
2358
- | ​   ↳ `type` | `string` | ❌ | — | `webhook` | Notification transport. Webhook is the only supported type. |
2359
- | ​   ↳ `url` | `string` | ✅ | — | — | URL to POST event notifications to. Payload is `{run_id, event}`. |
2360
- | ​   ↳ `max_retries` | `number` | ❌ | — | — | Max delivery attempts with exponential backoff. Defaults to 3 server-side. |
2361
- | ​   ↳ `events` | `array` | ✅ | — | — | One or more lifecycle events to subscribe this URL to. |
2204
+ | Name | Type | Required | Default | Possible Values | Description |
2205
+ | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
2206
+ | `options` | `object` | ✅ | — | — | |
2207
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2208
+ | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
2362
2209
 
2363
- **Returns:** `Promise<DurableRunItem>`
2210
+ **Returns:** `Promise<WorkflowDraftItem>`
2364
2211
 
2365
- | Name | Type | Required | Possible Values | Description |
2366
- | ---------------- | --------- | -------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
2367
- | `data` | `object` | ✅ | — | |
2368
- | ​ ↳ `id` | `string` | ✅ | — | Run ID (UUID) — server-generated, time-sortable |
2369
- | ​ ↳ `status` | `string` | ✅ | `initialized` | Always `initialized` on creation. Poll via getDurableRun to observe the run advancing to `started` / `finished` / `failed` / `cancelled`. |
2370
- | ​ ↳ `is_private` | `boolean` | ✅ | — | When true, the run is visible only to the creating user; otherwise visible across the account. |
2371
- | ​ ↳ `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
2212
+ | Name | Type | Required | Possible Values | Description |
2213
+ | ---------------------------- | -------- | -------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
2214
+ | `data` | `object` | ✅ | — | |
2215
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
2216
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2217
+ | ​ ↳ `slug` | `string` | ✅ | — | Human-friendly display name, not an identifier: two open drafts of a workflow may share one |
2218
+ | ​ ↳ `base_version_id` | `string` | ✅ | — | The version this draft was forked from (the live version at draft creation), or null when the workflow had no published version yet |
2219
+ | ​ ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
2220
+ | ​ ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this draft |
2221
+ | ​ ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this draft (or null) |
2222
+ | ​ ↳ `draft_revision` | `number` | ✅ | — | Monotonic revision counter for optimistic concurrency. Echo it back on draft updates to detect concurrent edits. |
2223
+ | ​ ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
2224
+ | ​ ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who created (forked) this draft |
2225
+ | ​ ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
2226
+ | ​ ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
2227
+ | ​ ↳ `discarded_at` | `string` | ✅ | — | When the draft was discarded (ISO-8601), or null while open |
2228
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
2229
+ | ​ ↳ `updated_at` | `string` | ✅ | — | When the draft row was last updated (ISO-8601) |
2230
+ | ​ ↳ `trigger` | `object` | ✅ | — | Trigger configuration held on this draft, or null for webhook-only workflows. |
2231
+ | ​ ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this draft (or null). |
2232
+ | ​ ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this draft (or null). |
2372
2233
 
2373
2234
  **Example:**
2374
2235
 
2375
2236
  ```typescript
2376
- const { data: durableRun } = await zapier.runDurable({
2377
- sourceFiles: {},
2237
+ const { data: workflowDraft } = await zapier.getWorkflowDraft({
2238
+ workflow: "example-workflow",
2239
+ draft: "example-draft",
2378
2240
  });
2379
2241
  ```
2380
2242
 
2381
- #### `runWorkflowDraft` 🧪 _experimental_
2243
+ #### `getWorkflowRun` 🧪 _experimental_
2382
2244
 
2383
- Launch a draft test run: execute the draft's current source without publishing it. The draft's payload is snapshotted onto the run at creation, so later edits (or discarding the draft) never change what the run executed. Draft runs are free (not task-charged) and rate limited per user. The run is accepted asynchronously — it comes back `initialized`; follow it with `getWorkflowRun`, or list it via `listWorkflowRuns` with `kind: "draft"`.
2245
+ Get the current state of a workflow run — a live run of a published workflow version, or a draft run launched via `runWorkflowDraft` (the `kind` field says which)
2384
2246
 
2385
2247
  **Parameters:**
2386
2248
 
2387
- | Name | Type | Required | Default | Possible Values | Description |
2388
- | ------------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2389
- | `options` | `object` | ✅ | — | — | |
2390
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2391
- | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
2392
- | ​ ↳ `draftRevision` | `number` | ✅ | — | — | The draft revision you intend to run, from the last read of the draft. The server rejects the run with a conflict if the draft has changed since. The upstream API treats this check as optional; the SDK requires it so a test run can never silently execute source the caller has already replaced. |
2393
- | ​ ↳ `input` | `unknown` | ❌ | — | — | Input data passed to the workflow. Accepts any JSON value, or its JSON-string encoding. Omit for a workflow that takes no input. |
2394
-
2395
- **Returns:** `Promise<RunWorkflowDraftResponse>`
2396
-
2397
- | Name | Type | Required | Possible Values | Description |
2398
- | ----------------------- | --------- | -------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
2399
- | `data` | `object` | ✅ | — | |
2400
- | ​ ↳ `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
2401
- | ​ ↳ `kind` | `string` | ✅ | `draft` | A run launched from a workflow draft. |
2402
- | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow this run belongs to |
2403
- | ​ ↳ `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Usually still null in this response — the run is accepted and launched in the background. |
2404
- | ​ ↳ `workflow_draft_id` | `string` | ✅ | — | The draft this run was launched from. Becomes null once that draft is deleted — the run outlives its draft. |
2405
- | ​ ↳ `draft_revision` | `number` | ✅ | — | The draft's revision at the moment this run was created. |
2406
- | ​ ↳ `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
2407
- | ​ ↳ `input` | `unknown` | ✅ | — | Input passed to the run |
2408
- | ​ ↳ `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
2409
- | ​ ↳ `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
2410
- | ​ ↳ `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
2411
- | ​ ↳ `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
2249
+ | Name | Type | Required | Default | Possible Values | Description |
2250
+ | -------------- | -------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------- |
2251
+ | `options` | `object` | ✅ | — | — | |
2252
+ | ​ ↳ `workflow` | `string` | ❌ | — | — | Parent workflow ID — used only to scope the CLI run-id picker; ignored by the API call. |
2253
+ | ​ ↳ `run` | `string` | ✅ | — | — | Workflow run ID |
2412
2254
 
2413
- **Example:**
2255
+ **Returns:** `Promise<WorkflowRunItem>`
2414
2256
 
2415
- ```typescript
2416
- const { data: workflowRun } = await zapier.runWorkflowDraft({
2417
- workflow: "example-workflow",
2418
- draft: "example-draft",
2419
- draftRevision: 100,
2420
- });
2421
- ```
2257
+ | Name | Type | Required | Possible Values | Description |
2258
+ | ------ | -------- | -------- | --------------- | -------------------------------------------------- |
2259
+ | `data` | `object` | ✅ | — | One of the variants below, distinguished by `kind` |
2422
2260
 
2423
- #### `triggerWorkflow` 🧪 _experimental_
2261
+ **When `kind` is `"live"`:**
2424
2262
 
2425
- Look up a workflow's trigger URL and fire it manually, as the authenticated account.
2426
-
2427
- **Parameters:**
2428
-
2429
- | Name | Type | Required | Default | Possible Values | Description |
2430
- | -------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2431
- | `options` | `object` | ✅ | — | — | |
2432
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2433
- | ​ ↳ `input` | `unknown` | ❌ | — | — | JSON payload delivered as the trigger body. Accepts any JSON value, or its JSON-string encoding. Sent as `application/json`; omit to fire with an empty body. |
2263
+ | Name | Type | Required | Possible Values | Description |
2264
+ | --------------------- | --------- | -------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- |
2265
+ | `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
2266
+ | `workflow_id` | `string` | ✅ | — | The workflow this run belongs to |
2267
+ | `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
2268
+ | `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
2269
+ | `input` | `unknown` | ✅ | — | Input passed to the run |
2270
+ | `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
2271
+ | `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
2272
+ | `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
2273
+ | `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
2274
+ | `kind` | `string` | ✅ | `live` | A run of a published workflow version. |
2275
+ | `trigger_id` | `string` | ✅ | — | ID of the trigger that fired this run. Null for runs created without a trigger. |
2276
+ | `workflow_version_id` | `string` | ✅ | — | Workflow version the run is bound to. Null in rare edge cases. |
2434
2277
 
2435
- **Returns:** `Promise<WorkflowRunItem>`
2278
+ **When `kind` is `"draft"`:**
2436
2279
 
2437
- | Name | Type | Required | Possible Values | Description |
2438
- | ----------------- | -------- | -------- | --------------- | ---------------------------------------- |
2439
- | `data` | `object` | ✅ | — | |
2440
- | ​ ↳ `id` | `string` | ✅ | — | Trigger ID (UUID) |
2441
- | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow that was triggered (UUID) |
2442
- | ​ ↳ `created_at` | `string` | ✅ | — | When the trigger was received (ISO-8601) |
2280
+ | Name | Type | Required | Possible Values | Description |
2281
+ | ------------------- | --------- | -------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2282
+ | `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
2283
+ | `workflow_id` | `string` | ✅ | — | The workflow this run belongs to |
2284
+ | `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
2285
+ | `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
2286
+ | `input` | `unknown` | ✅ | — | Input passed to the run |
2287
+ | `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
2288
+ | `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
2289
+ | `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
2290
+ | `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
2291
+ | `kind` | `string` | ✅ | `draft` | A run launched from a workflow draft via `runWorkflowDraft`. |
2292
+ | `workflow_draft_id` | `string` | ✅ | — | The draft this run was launched from. Null once that draft has been deleted (the run outlives its draft). |
2293
+ | `draft_revision` | `number` | ✅ | — | The draft's revision at the moment this run was created. Compare against the draft's current `draft_revision` to tell whether the run still reflects the draft as it now stands. |
2443
2294
 
2444
2295
  **Example:**
2445
2296
 
2446
2297
  ```typescript
2447
- const { data: workflowRun } = await zapier.triggerWorkflow({
2448
- workflow: "example-workflow",
2298
+ const { data: workflowRun } = await zapier.getWorkflowRun({
2299
+ run: "example-run",
2449
2300
  });
2450
2301
  ```
2451
2302
 
2452
- #### `updateAgenticManagementConfig` 🧪 _experimental_
2303
+ #### `getWorkflowVersion` 🧪 _experimental_
2453
2304
 
2454
- Change the modes a workflow runs, whether fixes are applied without approval, or both. A `modes` list replaces the whole current set rather than adding to it.
2305
+ Get full details of a workflow version including source files
2455
2306
 
2456
2307
  **Parameters:**
2457
2308
 
2458
- | Name | Type | Required | Default | Possible Values | Description |
2459
- | ----------------- | --------- | -------- | ------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2460
- | `options` | `object` | ✅ | — | — | |
2461
- | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to update. |
2462
- | ​ ↳ `modes` | `array` | ❌ | — | — | The modes to run. The list you pass replaces the whole current set in one step; it is not added to what is already active. Omit it to leave the active modes as they are. A mode is what Agentic Management watches for and what it changes in response. `heal` monitors runs for errors and, when something breaks, diagnoses the cause and drafts and tests a fix; it is the mode a workflow gets by default. `expand` grows what the workflow covers: it reviews runs that succeeded without actually doing anything — a lookup that matched nothing, a filter that passed no items, a trigger payload no branch handles — and proposes a new branch or step to handle that case, rather than rewriting the ones that already work. `harden` watches the AI steps: when an AI step keeps doing the same work the same way, it converts that step into fixed code, so the workflow runs faster, costs less, and behaves the same way every time. Modes stack — each one you name runs alongside the others, and a mode you leave out does nothing, so a workflow on `expand` alone does not repair failed runs. Whether a change goes live on its own or waits for someone to approve it is `autoApprove`, not the mode. |
2463
- | ​ ↳ `autoApprove` | `boolean` | ❌ | — | — | Apply the fixes Agentic Management proposes without asking first. Set it to false and each fix waits for someone to approve it before anything changes. Omit it to leave the current setting alone. |
2309
+ | Name | Type | Required | Default | Possible Values | Description |
2310
+ | -------------- | -------- | -------- | ------- | --------------- | ------------------- |
2311
+ | `options` | `object` | ✅ | — | — | |
2312
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2313
+ | ​ ↳ `version` | `string` | ✅ | — | — | Workflow version ID |
2464
2314
 
2465
- **Returns:** `Promise<AgenticManagementConfigItem>`
2315
+ **Returns:** `Promise<WorkflowVersionItem>`
2466
2316
 
2467
- | Name | Type | Required | Possible Values | Description |
2468
- | ------------------ | --------- | -------- | --------------- | ------------------------------------------------------------- |
2469
- | `data` | `object` | ✅ | — | |
2470
- | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow whose config was updated. |
2471
- | ​ ↳ `modes` | `array` | ✅ | — | The modes the workflow runs after this update. |
2472
- | ​ ↳ `auto_approve` | `boolean` | ✅ | — | Whether fixes are applied without approval after this update. |
2317
+ | Name | Type | Required | Possible Values | Description |
2318
+ | ---------------------------- | -------- | -------- | --------------- | ------------------------------------------------------------------------------------ |
2319
+ | `data` | `object` | ✅ | — | |
2320
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow version ID (UUID) |
2321
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2322
+ | ​ ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
2323
+ | ​ ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this version's runs |
2324
+ | ​ ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this version (or null) |
2325
+ | ​ ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who published this version |
2326
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the version was published (ISO-8601) |
2327
+ | ​ ↳ `trigger` | `object` | ✅ | — | Trigger configuration persisted on this version, or null for webhook-only workflows. |
2328
+ | ​ ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this version (or null). |
2329
+ | ​ ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this version (or null). |
2473
2330
 
2474
2331
  **Example:**
2475
2332
 
2476
2333
  ```typescript
2477
- const { data: agenticManagementConfig } =
2478
- await zapier.updateAgenticManagementConfig({
2479
- workflow: "example-workflow",
2480
- });
2334
+ const { data: workflowVersion } = await zapier.getWorkflowVersion({
2335
+ workflow: "example-workflow",
2336
+ version: "example-version",
2337
+ });
2481
2338
  ```
2482
2339
 
2483
- #### `updateAgenticManagementIntent` 🧪 _experimental_
2340
+ #### `importWorkflow` 🧪 _experimental_
2484
2341
 
2485
- Record what one workflow version is meant to do. Writing again for the same version replaces the text already stored, so there is no separate create and update.
2342
+ Convert an existing Zap into a durable workflow. Transforms the Zap's latest published version (falling back to its draft only when the Zap has never been published) and puts the resulting source in an open draft. The workflow is created disabled with no published version, so publish the draft to make it live. The original Zap is untouched and keeps running.
2486
2343
 
2487
2344
  **Parameters:**
2488
2345
 
2489
- | Name | Type | Required | Default | Possible Values | Description |
2490
- | -------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2491
- | `options` | `object` | ✅ | — | — | |
2492
- | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to write to. |
2493
- | ​ ↳ `intent` | `string` | ✅ | — | — | What this version of the workflow is for, in your own words: the outcome it produces, what sets it off, and anything that must always hold true. Plain prose, not code. |
2494
- | ​ ↳ `version` | `string` | ❌ | — | — | The workflow version the intent belongs to. Each version stores its own intent, and a version never picks up the intent of another, so publishing a new version starts it with none. Omit this to use the workflow's current published version. |
2346
+ | Name | Type | Required | Default | Possible Values | Description |
2347
+ | ------------- | --------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
2348
+ | `options` | `object` | ✅ | — | — | |
2349
+ | ​ ↳ `zap` | `string` | ✅ | — | — | ID of the Zap to import. Must be owned by the requesting user. Recorded on the created workflow as source_zap_id. |
2350
+ | ​ ↳ `name` | `string` | ❌ | — | — | Name for the created workflow. Defaults to a kebab-cased form of the Zap's title, or "imported-workflow" when the Zap has no title. |
2351
+ | ​ ↳ `private` | `boolean` | ❌ | — | — | Restrict the created workflow to the creating user. Defaults to false, which makes it account-visible. |
2495
2352
 
2496
- **Returns:** `Promise<AgenticManagementIntentItem>`
2353
+ **Returns:** `Promise<ImportWorkflowResponse>`
2497
2354
 
2498
- | Name | Type | Required | Possible Values | Description |
2499
- | ------------------------- | -------- | -------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2500
- | `data` | `object` | ✅ | — | |
2501
- | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow the intent belongs to. |
2502
- | ​ ↳ `workflow_version_id` | `string` | ✅ | — | The version this read or write actually landed on, so you can tell which one answered when you omitted `version`. `null` only when you read a workflow that has nothing published yet. |
2503
- | ​ ↳ `intent` | `string` | ✅ | — | The intent stored for this version, or `null` when this version has none. Intent is never carried over from another version. |
2504
- | ​ ↳ `updated_at` | `string` | ❌ | — | When the intent was last written; `null` when never captured. |
2355
+ | Name | Type | Required | Possible Values | Description |
2356
+ | ------------------------------ | ---------- | -------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2357
+ | `data` | `object` | ✅ | — | |
2358
+ | ​ ↳ `workflow` | `object` | ✅ | — | The created workflow. Disabled, with no published version, and source_zap_id set to the imported Zap. |
2359
+ | ​   ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
2360
+ | ​   ↳ `name` | `string` | ✅ | — | Workflow name |
2361
+ | ​   ↳ `description` | `string` | ❌ | — | Optional workflow description (null if unset) |
2362
+ | ​   ↳ `trigger_url` | `string` | ✅ | — | Public URL that fires this workflow when POSTed to. Embeds a trigger token in the path — treat as sensitive. Requests must also be authenticated as the account. |
2363
+ | ​   ↳ `editor_url` | `string` | ✅ | — | URL to the Zapier workflow editor for this workflow |
2364
+ | ​   ↳ `enabled` | `boolean` | ✅ | — | Whether the workflow accepts triggers. An import always lands disabled. |
2365
+ | ​   ↳ `disabled_reason` | `string` | ❌ | `trigger_claim_failed` | Why the workflow is off, when system-disabled. |
2366
+ | ​   ↳ `is_private` | `boolean` | ✅ | — | Whether the workflow is private to the creating user. False means account-visible. |
2367
+ | ​   ↳ `source_zap_id` | `string` | ❌ | — | The Zap this workflow was imported from. |
2368
+ | ​   ↳ `created_by_user_id` | `string` | ✅ | — | |
2369
+ | ​   ↳ `updated_by_user_id` | `string` | ❌ | — | |
2370
+ | ​   ↳ `current_version_id` | `string` | ❌ | — | Null on a fresh import, which has no published version yet. |
2371
+ | ​   ↳ `triggers[]` | `object[]` | ✅ | — | Empty on a fresh import, which has no published version yet. |
2372
+ | ​     ↳ `selected_api` | `string` | ✅ | — | Zapier app/API identifier (e.g. 'GoogleSheetsAPI') |
2373
+ | ​     ↳ `action` | `string` | ✅ | — | Trigger action key (e.g. 'new_row') |
2374
+ | ​     ↳ `authentication_id` | `string` | ❌ | — | Connection ID for the trigger source. Null for no-auth triggers. |
2375
+ | ​     ↳ `params` | `object` | ❌ | — | Trigger parameters as a JSON object |
2376
+ | ​     ↳ `status` | `string` | ✅ | `unclaimed`, `pending`, `active`, `releasing`, `released`, `failed` | Live trigger claim status — whether the trigger is currently subscribed to its source. |
2377
+ | ​     ↳ `error` | `string` | ❌ | — | Failure reason for the latest claim. Present (non-null) only when status is 'failed'. |
2378
+ | ​     ↳ `details` | `object` | ❌ | — | Trigger-type-specific metadata; shape varies by trigger type (e.g. `webhook_url` on catch-hook triggers). Null or absent when none applies. |
2379
+ | ​   ↳ `created_at` | `string` | ✅ | — | |
2380
+ | ​   ↳ `updated_at` | `string` | ❌ | — | |
2381
+ | ​ ↳ `draft` | `object` | ✅ | — | The open draft holding the transformed source. |
2382
+ | ​   ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
2383
+ | ​   ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2384
+ | ​   ↳ `slug` | `string` | ✅ | — | Human-friendly display name, not an identifier: two open drafts of a workflow may share one |
2385
+ | ​   ↳ `base_version_id` | `string` | ✅ | — | The version this draft was forked from (the live version at draft creation), or null when the workflow had no published version yet |
2386
+ | ​   ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
2387
+ | ​   ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this draft |
2388
+ | ​   ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this draft (or null) |
2389
+ | ​   ↳ `draft_revision` | `number` | ✅ | — | Monotonic revision counter for optimistic concurrency. Echo it back on draft updates to detect concurrent edits. |
2390
+ | ​   ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
2391
+ | ​   ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who created (forked) this draft |
2392
+ | ​   ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
2393
+ | ​   ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
2394
+ | ​   ↳ `discarded_at` | `string` | ✅ | — | When the draft was discarded (ISO-8601), or null while open |
2395
+ | ​   ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
2396
+ | ​   ↳ `updated_at` | `string` | ✅ | — | When the draft row was last updated (ISO-8601) |
2397
+ | ​   ↳ `trigger` | `object` | ✅ | — | Trigger configuration held on this draft, or null for webhook-only workflows. |
2398
+ | ​   ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this draft (or null). |
2399
+ | ​   ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this draft (or null). |
2400
+ | ​ ↳ `issues[]` | `object[]` | ✅ | — | Blocking and non-blocking translation issues from the transform, passed through unchanged. Blocking issues do not prevent draft creation; they must be resolved before the draft will publish. |
2401
+ | ​   ↳ `line` | `number` | ✅ | — | 1-based line in the generated source the issue relates to, or 0 when not line-specific. |
2402
+ | ​   ↳ `column` | `number` | ✅ | — | 1-based column, or 0 when not column-specific. |
2403
+ | ​   ↳ `node_kind` | `string` | ✅ | — | Category of the issue, used to group and message them, e.g. "invalid-connection-id", "DelayStep", "app-version-conflict". |
2404
+ | ​   ↳ `step_name` | `string` | ❌ | — | ZDL step id or name the issue originated from, when known. |
2405
+ | ​   ↳ `message` | `string` | ✅ | — | Human-readable description of the issue. |
2406
+ | ​   ↳ `blocking` | `boolean` | ✅ | — | Whether the issue must be resolved before the draft can be published. Computed server-side, so callers do not re-derive it. A blocking issue does not prevent the draft being created. |
2505
2407
 
2506
2408
  **Example:**
2507
2409
 
2508
2410
  ```typescript
2509
- const { data: agenticManagementIntent } =
2510
- await zapier.updateAgenticManagementIntent({
2511
- workflow: "example-workflow",
2512
- intent: "example-intent",
2513
- });
2411
+ const { data: workflow } = await zapier.importWorkflow({
2412
+ zap: "example-zap",
2413
+ });
2514
2414
  ```
2515
2415
 
2516
- #### `updateWorkflow` 🧪 _experimental_
2416
+ #### `listDurableRuns` 🧪 _experimental_
2517
2417
 
2518
- Update a durable workflow's name and/or description
2418
+ List run-once durable runs for the authenticated account, newest first
2519
2419
 
2520
2420
  **Parameters:**
2521
2421
 
2522
- | Name | Type | Required | Default | Possible Values | Description |
2523
- | ----------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------- |
2524
- | `options` | `object` | ✅ | — | — | |
2525
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2526
- | ​ ↳ `name` | `string` | ❌ | — | — | New name for the workflow |
2527
- | ​ ↳ `description` | `string` | ❌ | — | — | New description for the workflow (pass null to clear) |
2422
+ | Name | Type | Required | Default | Possible Values | Description |
2423
+ | -------------- | -------- | -------- | ------- | --------------- | ---------------------------------------------- |
2424
+ | `options` | `object` | ✅ | — | — | |
2425
+ | ​ ↳ `pageSize` | `number` | ❌ | — | — | Number of runs per page (max 100) |
2426
+ | ​ ↳ `cursor` | `string` | ❌ | — | — | Pagination cursor |
2427
+ | ​ ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
2528
2428
 
2529
- **Returns:** `Promise<WorkflowItem>`
2429
+ **Returns:** `Promise<PaginatedResult<DurableRunItem>>`
2530
2430
 
2531
- | Name | Type | Required | Possible Values | Description |
2532
- | ------------------------ | --------- | -------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2533
- | `data` | `object` | ✅ | — | |
2534
- | ​ ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
2535
- | ​ ↳ `name` | `string` | ✅ | — | Workflow name (post-update) |
2536
- | ​ ↳ `description` | `string` | ✅ | — | Workflow description, post-update (null if unset) |
2537
- | ​ ↳ `trigger_url` | `string` | ✅ | — | Public URL that fires this workflow when POSTed to. Embeds a trigger token in the path — treat as sensitive. Requests must also be authenticated as the account. |
2538
- | ​ ↳ `editor_url` | `string` | ✅ | — | URL to the Zapier workflow editor for this workflow |
2539
- | ​ ↳ `enabled` | `boolean` | ✅ | — | Whether the workflow currently accepts triggers |
2540
- | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the workflow is private to the creating user. False means account-visible. |
2541
- | ​ ↳ `created_by_user_id` | `string` | ✅ | — | User ID of the workflow creator (null in legacy data) |
2542
- | ​ ↳ `created_at` | `string` | ✅ | — | When the workflow was created (ISO-8601) |
2543
- | ​ ↳ `updated_at` | `string` | ✅ | — | When this update was applied (ISO-8601) |
2431
+ | Name | Type | Required | Possible Values | Description |
2432
+ | ------------------ | ---------- | -------- | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
2433
+ | `data[]` | `object[]` | ✅ | — | |
2434
+ | ​ ↳ `id` | `string` | ✅ | — | Run ID (UUID) |
2435
+ | ​ ↳ `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
2436
+ | ​ ↳ `input` | `unknown` | ✅ | — | Input data passed to the run |
2437
+ | ​ ↳ `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
2438
+ | ​ ↳ `error` | `object` | ✅ | — | Structured error details when the run failed (null otherwise) |
2439
+ | ​ ↳ `execution_id` | `string` | ✅ | — | Linked execution ID. Null until the run leaves the `initialized` state. |
2440
+ | ​ ↳ `is_private` | `boolean` | ✅ | — | When true, the run is visible only to the creating user; otherwise visible across the account. |
2441
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
2442
+ | ​ ↳ `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
2443
+ | `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
2544
2444
 
2545
2445
  **Example:**
2546
2446
 
2547
2447
  ```typescript
2548
- const { data: workflow } = await zapier.updateWorkflow({
2549
- workflow: "example-workflow",
2550
- });
2448
+ // Get first page and a cursor for the second page
2449
+ const { data: durableRuns, nextCursor } = await zapier.listDurableRuns();
2450
+
2451
+ // Or iterate over all pages
2452
+ for await (const page of zapier.listDurableRuns().pages()) {
2453
+ // Do something with each page
2454
+ }
2455
+
2456
+ // Or iterate over individual items across all pages
2457
+ for await (const durableRun of zapier.listDurableRuns().items()) {
2458
+ // Do something with each durableRun
2459
+ }
2551
2460
  ```
2552
2461
 
2553
- #### `updateWorkflowDraft` 🧪 _experimental_
2462
+ #### `listWorkflowDrafts` 🧪 _experimental_
2554
2463
 
2555
- Update (autosave) an open workflow draft
2464
+ List drafts for a workflow, most recently edited first (open drafts by default)
2556
2465
 
2557
2466
  **Parameters:**
2558
2467
 
2559
- | Name | Type | Required | Default | Possible Values | Description |
2560
- | -------------------------- | --------- | -------- | ------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2561
- | `options` | `object` | ✅ | — | — | |
2562
- | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2563
- | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
2564
- | ​ ↳ `sourceFiles` | `object` | ✅ | — | — | Source files keyed by filename → contents |
2565
- | ​ ↳ `zapierDurableVersion` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"), or "latest". Leaves the stored pin unchanged if omitted. A draft stores what you pass verbatim, so "latest" is recorded as-is and resolved to an exact version when the draft is published -- reading the draft back shows "latest", not a version. Ranges (^1.2.3, ~1.2) are rejected at publish. |
2566
- | ​ ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies. A version of "latest" is resolved by the server for @zapier/zapier-durable and @zapier/zapier-sdk only; every other value, including a "latest" on any other package, is passed to the install as written. |
2567
- | ​ ↳ `draftRevision` | `number` | ❌ | — | — | Expected draft revision for optimistic concurrency. Pass the revision from the last read; the server rejects the save with a conflict if the draft has changed since. Omit to skip the check. |
2568
- | ​ ↳ `trigger` | `object` | ❌ | — | — | Trigger configuration. Omit to leave the stored trigger unchanged, pass null to clear it, or pass an object to replace it; for an on-demand, triggerless workflow, clear this and pass `manual: true` instead. |
2569
- | ​ ↳ `connections` | `object` | ❌ | — | — | Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding. |
2570
- | ​ ↳ `appVersions` | `object` | ❌ | — | — | Map of app keys to pinned app implementation/version used by the workflow. Pass `null` to clear an existing binding. |
2571
- | ​ ↳ `manual` | `boolean` | ❌ | — | — | Declare this draft on-demand and triggerless. Pass `manual: true` only when omitting `trigger` (or clearing it with `trigger: null`); passing both is a contradiction the API rejects with a 400. Setting a `trigger` later clears a previously stored `manual: true`. |
2572
-
2573
- **Returns:** `Promise<WorkflowDraftItem>`
2468
+ | Name | Type | Required | Default | Possible Values | Description |
2469
+ | -------------- | -------- | -------- | ------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2470
+ | `options` | `object` | ✅ | — | — | |
2471
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2472
+ | ​ ↳ `status` | `string` | ❌ | — | `open`, `discarded` | Filter by draft status (server default: open) |
2473
+ | ​ ↳ `slug` | `string` | ❌ | — | — | Filter by exact slug match. Slugs are not unique, so this returns every draft with this slug matching the selected status, ordered by most recent activity and paginated |
2474
+ | ​ ↳ `pageSize` | `number` | ❌ | — | — | Number of drafts per page (max 100) |
2475
+ | ​ ↳ `cursor` | `string` | ❌ | — | — | Pagination cursor |
2476
+ | ​ ↳ `maxItems` | `number` | ❌ | — | — | Maximum total drafts to return across all pages |
2574
2477
 
2575
- | Name | Type | Required | Possible Values | Description |
2576
- | ---------------------------- | -------- | -------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
2577
- | `data` | `object` | ✅ | — | |
2578
- | ​ ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
2579
- | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2580
- | ​ ↳ `slug` | `string` | ✅ | — | Human-friendly display name, not an identifier: two open drafts of a workflow may share one |
2581
- | ​ ↳ `base_version_id` | `string` | ✅ | — | The version this draft was forked from (the live version at draft creation), or null when the workflow had no published version yet |
2582
- | ​ ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
2583
- | ​ ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this draft |
2584
- | ​ ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this draft (or null) |
2585
- | ​ ↳ `draft_revision` | `number` | ✅ | — | Monotonic revision counter for optimistic concurrency. Echo it back on draft updates to detect concurrent edits. |
2586
- | ​ ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
2587
- | ​ ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who created (forked) this draft |
2588
- | ​ ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
2589
- | ​ ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
2590
- | ​ ↳ `discarded_at` | `string` | ✅ | — | When the draft was discarded (ISO-8601), or null while open |
2591
- | ​ ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
2592
- | ​ ↳ `updated_at` | `string` | ✅ | — | When the draft row was last updated (ISO-8601) |
2593
- | ​ ↳ `trigger` | `object` | ✅ | — | Trigger configuration held on this draft, or null for webhook-only workflows. |
2594
- | ​ ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this draft (or null). |
2595
- | ​ ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this draft (or null). |
2478
+ **Returns:** `Promise<PaginatedResult<WorkflowDraftItem>>`
2479
+
2480
+ | Name | Type | Required | Possible Values | Description |
2481
+ | ---------------------------- | ---------- | -------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
2482
+ | `data[]` | `object[]` | ✅ | — | |
2483
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
2484
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2485
+ | ​ ↳ `slug` | `string` | ✅ | — | Human-friendly display name, not an identifier: two open drafts of a workflow may share one |
2486
+ | ​ ↳ `base_version_id` | `string` | ✅ | — | The version this draft was forked from (the live version at draft creation), or null when the workflow had no published version yet |
2487
+ | ​ ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
2488
+ | ​ ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
2489
+ | ​ ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
2490
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
2491
+ | `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
2596
2492
 
2597
2493
  **Example:**
2598
2494
 
2599
2495
  ```typescript
2600
- const { data: workflowDraft } = await zapier.updateWorkflowDraft({
2496
+ // Get first page and a cursor for the second page
2497
+ const { data: workflowDrafts, nextCursor } = await zapier.listWorkflowDrafts({
2601
2498
  workflow: "example-workflow",
2602
- draft: "example-draft",
2603
- sourceFiles: {},
2604
2499
  });
2500
+
2501
+ // Or iterate over all pages
2502
+ for await (const page of zapier
2503
+ .listWorkflowDrafts({
2504
+ workflow: "example-workflow",
2505
+ })
2506
+ .pages()) {
2507
+ // Do something with each page
2508
+ }
2509
+
2510
+ // Or iterate over individual items across all pages
2511
+ for await (const workflowDraft of zapier
2512
+ .listWorkflowDrafts({
2513
+ workflow: "example-workflow",
2514
+ })
2515
+ .items()) {
2516
+ // Do something with each workflowDraft
2517
+ }
2605
2518
  ```
2606
2519
 
2607
- #### `validateWorkflow` 🧪 _experimental_
2520
+ #### `listWorkflowRuns` 🧪 _experimental_
2608
2521
 
2609
- Validate durable workflow source without publishing it. Returns source diagnostics; issue kinds are extensible and may be unfamiliar to the client.
2522
+ List workflow runs for a specific workflow, newest first. Live runs (of published versions) and draft runs share the one list; pass `kind` to narrow it to one.
2610
2523
 
2611
2524
  **Parameters:**
2612
2525
 
2613
- | Name | Type | Required | Default | Possible Values | Description |
2614
- | -------------------- | -------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------- |
2615
- | `options` | `object` | ✅ | — | — | |
2616
- | ​ ↳ `sourceFiles` | `object` | ✅ | — | — | Exact TypeScript sources keyed by absolute logical path. |
2617
- | ​ ↳ `entrypointFile` | `string` | ❌ | — | — | Absolute logical path of the entry file in sourceFiles. Defaults to /workflow.ts. |
2526
+ | Name | Type | Required | Default | Possible Values | Description |
2527
+ | -------------- | -------- | -------- | ------- | --------------- | --------------------------------------------------------------------- |
2528
+ | `options` | `object` | ✅ | — | — | |
2529
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2530
+ | ​ ↳ `pageSize` | `number` | ❌ | — | — | Number of runs per page (max 100) |
2531
+ | ​ ↳ `kind` | `string` | ❌ | — | `live`, `draft` | Return only runs of this kind. Omit for both, interleaved by recency. |
2532
+ | ​ ↳ `cursor` | `string` | ❌ | — | — | Pagination cursor |
2533
+ | ​ ↳ `maxItems` | `number` | ❌ | — | — | Maximum total runs to return across all pages |
2618
2534
 
2619
- **Returns:** `Promise<WorkflowValidationItem>`
2535
+ **Returns:** `Promise<PaginatedResult<WorkflowRunItem>>`
2620
2536
 
2621
- | Name | Type | Required | Possible Values | Description |
2622
- | ---------------------- | ---------- | -------- | ---------------------------------- | ----------------------------------------------------------------------------------- |
2623
- | `data` | `object` | ✅ | — | |
2624
- | ​ ↳ `issues[]` | `object[]` | ✅ | — | Source diagnostics, or an empty array when validation passes. |
2625
- | ​   ↳ `kind` | `string` | ✅ | — | Extensible diagnostic category; clients must accept unfamiliar values. |
2626
- | ​   ↳ `message` | `string` | ✅ | — | Safe human-readable explanation. |
2627
- | ​   ↳ `severity` | `string` | ✅ | `error`, `warning`, `info`, `hint` | Diagnostic severity. |
2628
- | ​   ↳ `suggestion` | `string` | ❌ | — | Actionable fix hint. |
2629
- | ​   ↳ `source` | `object` | ❌ | — | Affected source location. |
2630
- | ​     ↳ `file_id` | `string` | ✅ | — | Source file containing the diagnostic. |
2631
- | ​     ↳ `start_line` | `number` | ✅ | — | Inclusive 1-based start line. |
2632
- | ​     ↳ `start_column` | `number` | ✅ | — | Inclusive 1-based start column. |
2633
- | ​     ↳ `end_line` | `number` | ✅ | — | Inclusive 1-based end line. |
2634
- | ​     ↳ `end_column` | `number` | ✅ | — | Inclusive 1-based end column. |
2635
- | ​   ↳ `source_excerpt` | `string` | ❌ | — | Source text the diagnostic was raised against, truncated to 240 characters. |
2636
- | ​   ↳ `syntax_kind` | `string` | ❌ | — | TypeScript AST node kind the diagnostic was raised against (e.g. `CallExpression`). |
2537
+ | Name | Type | Required | Possible Values | Description |
2538
+ | ------------ | ---------- | -------- | --------------- | -------------------------------------------------------------- |
2539
+ | `data[]` | `object[]` | ✅ | — | One of the variants below, distinguished by `kind` |
2540
+ | `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
2541
+
2542
+ **When `kind` is `"live"`:**
2543
+
2544
+ | Name | Type | Required | Possible Values | Description |
2545
+ | --------------------- | --------- | -------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------- |
2546
+ | `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
2547
+ | `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
2548
+ | `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
2549
+ | `input` | `unknown` | ✅ | — | Input passed to the run |
2550
+ | `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
2551
+ | `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
2552
+ | `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
2553
+ | `kind` | `string` | ✅ | `live` | A run of a published workflow version. |
2554
+ | `trigger_id` | `string` | ✅ | — | ID of the trigger that fired this run. Null for runs created without a trigger. |
2555
+ | `workflow_version_id` | `string` | ✅ | — | Workflow version the run is bound to. Null in rare edge cases. |
2556
+
2557
+ **When `kind` is `"draft"`:**
2558
+
2559
+ | Name | Type | Required | Possible Values | Description |
2560
+ | ------------------- | --------- | -------- | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
2561
+ | `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
2562
+ | `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Null until the durable run is created. |
2563
+ | `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
2564
+ | `input` | `unknown` | ✅ | — | Input passed to the run |
2565
+ | `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
2566
+ | `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
2567
+ | `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
2568
+ | `kind` | `string` | ✅ | `draft` | A run launched from a workflow draft via `runWorkflowDraft`. |
2569
+ | `workflow_draft_id` | `string` | ✅ | — | The draft this run was launched from. Null once that draft has been deleted (the run outlives its draft). |
2570
+ | `draft_revision` | `number` | ✅ | — | The draft's revision at the moment this run was created. |
2637
2571
 
2638
2572
  **Example:**
2639
2573
 
2640
2574
  ```typescript
2641
- const { data: workflowValidation } = await zapier.validateWorkflow({
2642
- sourceFiles: {
2643
- "/workflow.ts":
2644
- 'import { defineDurable } from "@zapier/zapier-durable"; export default defineDurable("hello-world", async (ctx, input) => { return ctx.step("greet", async () => "Hello, world!"); });',
2645
- },
2575
+ // Get first page and a cursor for the second page
2576
+ const { data: workflowRuns, nextCursor } = await zapier.listWorkflowRuns({
2577
+ workflow: "example-workflow",
2646
2578
  });
2579
+
2580
+ // Or iterate over all pages
2581
+ for await (const page of zapier
2582
+ .listWorkflowRuns({
2583
+ workflow: "example-workflow",
2584
+ })
2585
+ .pages()) {
2586
+ // Do something with each page
2587
+ }
2588
+
2589
+ // Or iterate over individual items across all pages
2590
+ for await (const workflowRun of zapier
2591
+ .listWorkflowRuns({
2592
+ workflow: "example-workflow",
2593
+ })
2594
+ .items()) {
2595
+ // Do something with each workflowRun
2596
+ }
2647
2597
  ```
2648
2598
 
2649
- ### Connections
2599
+ #### `listWorkflowVersions` 🧪 _experimental_
2650
2600
 
2651
- #### `createConnection`
2601
+ List published versions for a workflow, newest first
2652
2602
 
2653
- Create a new app connection, end-to-end. Mints the start URL via `get-connection-start-url`, prints it to stderr, opportunistically opens it in a browser when it looks safe to do so (skipping CI / SSH / headless-Linux by default — pass `--browser always` to force, `--browser never` to suppress), then polls via `wait-for-new-connection` until the user completes OAuth and the new connection appears. Returns the connection.
2603
+ **Parameters:**
2654
2604
 
2655
- This is the right command for most callers. Reach for the lower-level building blocks when you want either of: (a) hand off the URL and _not_ block on completion — call `get-connection-start-url` alone, no `wait-for-new-connection` needed, or (b) do something custom between minting the URL and waiting — call `get-connection-start-url`, do your work (email or DM the URL, render a QR code, etc.), then `wait-for-new-connection`.
2605
+ | Name | Type | Required | Default | Possible Values | Description |
2606
+ | -------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------- |
2607
+ | `options` | `object` | ✅ | — | — | |
2608
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2609
+ | ​ ↳ `pageSize` | `number` | ❌ | — | — | Number of versions per page (max 100) |
2610
+ | ​ ↳ `cursor` | `string` | ❌ | — | — | Pagination cursor |
2611
+ | ​ ↳ `maxItems` | `number` | ❌ | — | — | Maximum total versions to return across all pages |
2612
+
2613
+ **Returns:** `Promise<PaginatedResult<WorkflowVersionItem>>`
2614
+
2615
+ | Name | Type | Required | Possible Values | Description |
2616
+ | ---------------------------- | ---------- | -------- | --------------- | ------------------------------------------------------------------------------------ |
2617
+ | `data[]` | `object[]` | ✅ | — | |
2618
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow version ID (UUID) |
2619
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2620
+ | ​ ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this version's runs |
2621
+ | ​ ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this version (or null) |
2622
+ | ​ ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who published this version |
2623
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the version was published (ISO-8601) |
2624
+ | ​ ↳ `trigger` | `object` | ✅ | — | Trigger configuration persisted on this version, or null for webhook-only workflows. |
2625
+ | ​ ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this version (or null). |
2626
+ | ​ ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this version (or null). |
2627
+ | `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
2628
+
2629
+ **Example:**
2630
+
2631
+ ```typescript
2632
+ // Get first page and a cursor for the second page
2633
+ const { data: workflowVersions, nextCursor } =
2634
+ await zapier.listWorkflowVersions({
2635
+ workflow: "example-workflow",
2636
+ });
2637
+
2638
+ // Or iterate over all pages
2639
+ for await (const page of zapier
2640
+ .listWorkflowVersions({
2641
+ workflow: "example-workflow",
2642
+ })
2643
+ .pages()) {
2644
+ // Do something with each page
2645
+ }
2646
+
2647
+ // Or iterate over individual items across all pages
2648
+ for await (const workflowVersion of zapier
2649
+ .listWorkflowVersions({
2650
+ workflow: "example-workflow",
2651
+ })
2652
+ .items()) {
2653
+ // Do something with each workflowVersion
2654
+ }
2655
+ ```
2656
+
2657
+ #### `listWorkflows` 🧪 _experimental_
2658
+
2659
+ List all active durable workflows for the authenticated account
2656
2660
 
2657
2661
  **Parameters:**
2658
2662
 
2659
- | Name | Type | Required | Default | Possible Values | Description |
2660
- | ------------------------------ | -------- | -------- | -------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2661
- | `options` | `object` | ✅ | — | — | |
2662
- | ​ ↳ `app` | `string` | ✅ | — | — | App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3') |
2663
- | ​ ↳ `browser` | `string` | ❌ | `"auto"` | `auto`, `always`, `never` | When to auto-open the URL in a browser. `auto` (default) opens in local sessions and skips opening in CI / SSH / headless-Linux. `always` forces the open attempt. `never` skips it. The URL is always printed to stderr regardless — a failed or skipped open degrades gracefully to copy-paste. |
2664
- | ​ ↳ `timeoutSeconds` | `number` | ❌ | — | — | How long to wait for the user to complete the connection flow before giving up. Default 5 minutes (300). |
2665
- | ​ ↳ `pollIntervalMilliseconds` | `number` | ❌ | — | — | Delay before the first poll request, in ms. Default 3 seconds (3_000). Subsequent polling cadence is managed by the SDK's polling primitive (backoff with sane defaults). |
2663
+ | Name | Type | Required | Default | Possible Values | Description |
2664
+ | -------------- | -------- | -------- | ------- | --------------- | -------------------------------------------------- |
2665
+ | `options` | `object` | ✅ | — | — | |
2666
+ | ​ ↳ `pageSize` | `number` | ❌ | — | — | Number of workflows per page (max 100) |
2667
+ | ​ ↳ `maxItems` | `number` | ❌ | — | — | Maximum total workflows to return across all pages |
2668
+ | ​ ↳ `cursor` | `string` | ❌ | — | — | Cursor to start from for pagination |
2666
2669
 
2667
- **Returns:** `Promise<ConnectionItem>`
2670
+ **Returns:** `Promise<PaginatedResult<WorkflowItem>>`
2668
2671
 
2669
- | Name | Type | Required | Possible Values | Description |
2670
- | ----------- | -------- | -------- | --------------- | ------------------------------------------------------------------------------------ |
2671
- | `data` | `object` | ✅ | — | |
2672
- | ​ ↳ `id` | `string` | ✅ | — | The new connection's ID. Public UUID when available, falling back to the numeric ID. |
2673
- | ​ ↳ `app` | `string` | ✅ | — | Versionless app key the connection was created for (e.g., 'SlackCLIAPI'). |
2674
- | ​ ↳ `title` | `string` | ❌ | — | Human-readable connection title set by the auth flow, when available. |
2672
+ | Name | Type | Required | Possible Values | Description |
2673
+ | ------------------------- | ---------- | -------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2674
+ | `data[]` | `object[]` | ✅ | — | |
2675
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
2676
+ | ​ ↳ `name` | `string` | ✅ | — | Workflow name |
2677
+ | ​ ↳ `description` | `string` | ✅ | — | Optional workflow description (null if unset) |
2678
+ | ​ ↳ `trigger_url` | `string` | ✅ | — | Public URL that fires this workflow when POSTed to. Embeds a trigger token in the path — treat as sensitive. Requests must also be authenticated as the account. |
2679
+ | ​ ↳ `editor_url` | `string` | ✅ | — | URL to the Zapier workflow editor for this workflow |
2680
+ | ​ ↳ `enabled` | `boolean` | ✅ | — | Whether the workflow currently accepts triggers |
2681
+ | ​ ↳ `disabled_reason` | `string` | ❌ | `trigger_claim_failed` | Why the workflow is off, when system-disabled. Null when not system-disabled. |
2682
+ | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the workflow is private to the creating user. False means account-visible. |
2683
+ | ​ ↳ `created_by_user_id` | `string` | ✅ | — | User ID of the workflow creator (null in legacy data) |
2684
+ | ​ ↳ `current_version_id` | `string` | ✅ | — | ID of the workflow version that runs handle. Null until a version is published. |
2685
+ | ​ ↳ `triggers[]` | `object[]` | ✅ | — | Trigger configurations from the current version, with live claim status. Empty array when the workflow has no triggers. |
2686
+ | ​   ↳ `selected_api` | `string` | ✅ | — | Zapier app/API identifier (e.g. 'GoogleSheetsAPI') |
2687
+ | ​   ↳ `action` | `string` | ✅ | — | Trigger action key (e.g. 'new_row') |
2688
+ | ​   ↳ `authentication_id` | `string` | ❌ | — | Connection ID for the trigger source. Null for no-auth triggers. |
2689
+ | ​   ↳ `params` | `object` | ❌ | — | Trigger parameters as a JSON object |
2690
+ | ​   ↳ `status` | `string` | ✅ | `unclaimed`, `pending`, `active`, `releasing`, `released`, `failed` | Live trigger claim status — whether the trigger is currently subscribed to its source. |
2691
+ | ​   ↳ `error` | `string` | ❌ | — | Failure reason for the latest claim. Present (non-null) only when status is 'failed'. |
2692
+ | ​   ↳ `details` | `object` | ❌ | — | Trigger-type-specific metadata; shape varies by trigger type (e.g. `webhook_url` on catch-hook triggers). Null or absent when none applies. |
2693
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the workflow was created (ISO-8601) |
2694
+ | ​ ↳ `updated_at` | `string` | ✅ | — | When the workflow was last modified (ISO-8601) |
2695
+ | `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
2675
2696
 
2676
2697
  **Example:**
2677
2698
 
2678
2699
  ```typescript
2679
- const { data: connection } = await zapier.createConnection({
2680
- app: "example-app",
2700
+ // Get first page and a cursor for the second page
2701
+ const { data: workflows, nextCursor } = await zapier.listWorkflows();
2702
+
2703
+ // Or iterate over all pages
2704
+ for await (const page of zapier.listWorkflows().pages()) {
2705
+ // Do something with each page
2706
+ }
2707
+
2708
+ // Or iterate over individual items across all pages
2709
+ for await (const workflow of zapier.listWorkflows().items()) {
2710
+ // Do something with each workflow
2711
+ }
2712
+ ```
2713
+
2714
+ #### `publishWorkflowDraft` 🧪 _experimental_
2715
+
2716
+ Publish an open draft as a new immutable workflow version. Advances the workflow's live pointer and discards the draft — publish consumes it, so an open draft always means unpublished work. Continue editing by creating a new draft, which forks from the just-published version.
2717
+
2718
+ **Parameters:**
2719
+
2720
+ | Name | Type | Required | Default | Possible Values | Description |
2721
+ | ------------------- | --------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2722
+ | `options` | `object` | ✅ | — | — | |
2723
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2724
+ | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
2725
+ | ​ ↳ `enabled` | `boolean` | ❌ | — | — | Set the workflow's enabled state as part of the publish. If omitted, the current enabled state is preserved. |
2726
+ | ​ ↳ `draftRevision` | `number` | ❌ | — | — | Expected draft revision for optimistic concurrency. Pass the revision from the last read; the server rejects the publish with a conflict if the draft has changed since. Omit to skip the check. |
2727
+ | ​ ↳ `manual` | `boolean` | ❌ | — | — | Declare this publish on-demand and triggerless, overriding the draft's stored intent for this publish only. Pass `manual: true` only when the draft has no trigger configured; the API rejects a draft with a trigger published as `manual: true` as a contradiction (400). |
2728
+
2729
+ **Returns:** `Promise<PublishWorkflowDraftResponse>`
2730
+
2731
+ | Name | Type | Required | Possible Values | Description |
2732
+ | ------------------------------ | -------- | -------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
2733
+ | `data` | `object` | ✅ | — | |
2734
+ | ​ ↳ `draft` | `object` | ✅ | — | The consumed draft: status is 'discarded' and discarded_at is set. base_version_id still records the version the draft was forked from. |
2735
+ | ​   ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
2736
+ | ​   ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2737
+ | ​   ↳ `slug` | `string` | ✅ | — | Human-friendly display name, not an identifier: two open drafts of a workflow may share one |
2738
+ | ​   ↳ `base_version_id` | `string` | ✅ | — | The version this draft was forked from (the live version at draft creation), or null when the workflow had no published version yet |
2739
+ | ​   ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
2740
+ | ​   ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this draft |
2741
+ | ​   ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this draft (or null) |
2742
+ | ​   ↳ `draft_revision` | `number` | ✅ | — | Monotonic revision counter for optimistic concurrency. Echo it back on draft updates to detect concurrent edits. |
2743
+ | ​   ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
2744
+ | ​   ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who created (forked) this draft |
2745
+ | ​   ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
2746
+ | ​   ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
2747
+ | ​   ↳ `discarded_at` | `string` | ✅ | — | When the draft was discarded (ISO-8601), or null while open |
2748
+ | ​   ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
2749
+ | ​   ↳ `updated_at` | `string` | ✅ | — | When the draft row was last updated (ISO-8601) |
2750
+ | ​   ↳ `trigger` | `object` | ✅ | — | Trigger configuration held on this draft, or null for webhook-only workflows. |
2751
+ | ​   ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this draft (or null). |
2752
+ | ​   ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this draft (or null). |
2753
+ | ​ ↳ `version` | `object` | ✅ | — | The newly published immutable workflow version, now live. |
2754
+ | ​   ↳ `id` | `string` | ✅ | — | Workflow version ID (UUID) |
2755
+ | ​   ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2756
+ | ​   ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
2757
+ | ​   ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this version's runs |
2758
+ | ​   ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this version (or null) |
2759
+ | ​   ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who published this version |
2760
+ | ​   ↳ `created_at` | `string` | ✅ | — | When the version was published (ISO-8601) |
2761
+ | ​   ↳ `trigger` | `object` | ✅ | — | Trigger configuration persisted on this version, or null for webhook-only workflows. |
2762
+ | ​   ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this version (or null). |
2763
+ | ​   ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this version (or null). |
2764
+
2765
+ **Example:**
2766
+
2767
+ ```typescript
2768
+ const { data: workflowVersion } = await zapier.publishWorkflowDraft({
2769
+ workflow: "example-workflow",
2770
+ draft: "example-draft",
2681
2771
  });
2682
2772
  ```
2683
2773
 
2684
- #### `findFirstConnection`
2774
+ #### `publishWorkflowVersion` 🧪 _experimental_
2685
2775
 
2686
- Find the first connection matching the criteria
2776
+ Publish a new version of a durable workflow. Enables the workflow by default.
2687
2777
 
2688
2778
  **Parameters:**
2689
2779
 
2690
- | Name | Type | Required | Default | Possible Values | Description |
2691
- | ------------------- | --------- | -------- | ------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
2692
- | `options` | `object` | ✅ | — | — | |
2693
- | ​ ↳ `search` | `string` | ❌ | — | — | Search term to filter connections by title |
2694
- | ​ ↳ `title` | `string` | ❌ | — | — | Filter connections by exact title match (searches first, then filters locally) |
2695
- | ​ ↳ `owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own connections or a specific user ID |
2696
- | ​ ↳ `app` | `string` | ❌ | — | — | App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github') |
2697
- | ​ ↳ `account` | `string` | ❌ | — | — | Account to filter by |
2698
- | ​ ↳ `includeShared` | `boolean` | ❌ | — | — | Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections. |
2699
- | ​ ↳ `status` | `string` | ❌ | — | `active`, `expired`, `all` | Filter connections by expiry: 'active' (default) returns only non-expired connections, 'expired' only expired ones, and 'all' returns both. |
2780
+ | Name | Type | Required | Default | Possible Values | Description |
2781
+ | -------------------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2782
+ | `options` | `object` | ✅ | — | — | |
2783
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2784
+ | ​ ↳ `sourceFiles` | `object` | ✅ | — | — | Source files keyed by filename → contents |
2785
+ | ​ ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies. A version of "latest" is resolved by the server for @zapier/zapier-durable and @zapier/zapier-sdk only; every other value, including a "latest" on any other package, is passed to the install as written. |
2786
+ | ​ ↳ `zapierDurableVersion` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"), or "latest". Defaults to the server-configured version if omitted. "latest" is resolved by the server to the newest release old enough to clear the sandbox install age gate (24h) -- this is not npm's "latest" tag, which can point at a release too new to install. Ranges (^1.2.3, ~1.2) are rejected. |
2787
+ | ​ ↳ `enabled` | `boolean` | ❌ | — | — | Enable the workflow after publishing. Defaults to true if omitted; pass false to publish without enabling. |
2788
+ | ​ ↳ `ignoreOpenDrafts` | `boolean` | ❌ | — | — | Publish even though the workflow has open draft(s). Without this, the API rejects a direct publish with a 409 while any draft is open, since publishing the draft later would ship its stale content over this version. |
2789
+ | ​ ↳ `connections` | `object` | ❌ | — | — | Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding. |
2790
+ | ​ ↳ `appVersions` | `object` | ❌ | — | — | Map of app keys to pinned app implementation/version used by the workflow. Pass `null` to clear an existing binding. |
2791
+ | ​ ↳ `trigger` | `object` | ❌ | — | — | Trigger configuration. When provided, the workflow subscribes to a Zapier trigger; for an on-demand, triggerless workflow, omit this and pass `manual: true` instead. |
2792
+ | ​   ↳ `selectedApi` | `string` | ❌ | — | — | Zapier app/API identifier (e.g. 'GoogleSheetsAPI'). Required when a trigger is configured. |
2793
+ | ​   ↳ `action` | `string` | ✅ | — | — | Trigger action key (e.g. 'new_row') |
2794
+ | ​   ↳ `authenticationId` | `string` | ❌ | — | — | Connection ID for the trigger source. Omit or pass null for no-auth triggers (e.g. Schedule by Zapier). |
2795
+ | ​   ↳ `params` | `object` | ❌ | — | — | Trigger parameters as a JSON object |
2796
+ | ​ ↳ `manual` | `boolean` | ❌ | — | — | Declare this an on-demand, triggerless workflow version. Pass `manual: true` only when omitting `trigger`; passing both is a contradiction the API rejects with a 400. |
2700
2797
 
2701
- **Returns:** `Promise<ConnectionItem>`
2798
+ **Returns:** `Promise<WorkflowVersionItem>`
2702
2799
 
2703
- | Name | Type | Required | Possible Values | Description |
2704
- | ------------------------------ | --------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
2705
- | `data` | `object` | ✅ | — | |
2706
- | ​ ↳ `id` | `string` | ✅ | — | Unique identifier for the connection |
2707
- | ​ ↳ `date` | `string` | ✅ | — | Date created |
2708
- | ​ ↳ `lastchanged` | `string` | ❌ | — | Date last changed |
2709
- | ​ ↳ `account_id` | `string` | ✅ | — | Account ID associated with this connection |
2710
- | ​ ↳ `slug` | `string` | ❌ | — | Human-readable app slug for this connection's integration (e.g. 'google-sheets'). Null when no slug is registered for the app. |
2711
- | ​ ↳ `destination_selected_api` | `string` | ❌ | — | Destination API key (if applicable) |
2712
- | ​ ↳ `is_invite_only` | `boolean` | ✅ | — | Whether the connection is invite-only |
2713
- | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the connection is private |
2714
- | ​ ↳ `shared_with_all` | `boolean` | ✅ | — | Whether the connection is shared with all users |
2715
- | ​ ↳ `is_stale` | `string` | ❌ | — | Stale status string |
2716
- | ​ ↳ `is_shared` | `string` | ❌ | — | Shared status string |
2717
- | ​ ↳ `marked_stale_at` | `string` | ❌ | — | Date when marked stale |
2718
- | ​ ↳ `label` | `string` | ❌ | — | User label for the connection |
2719
- | ​ ↳ `identifier` | `string` | ❌ | — | Identifier |
2720
- | ​ ↳ `title` | `string` | ❌ | — | Title of the connection |
2721
- | ​ ↳ `url` | `string` | ❌ | — | URL to the connection resource |
2722
- | ​ ↳ `groups` | `array` | ❌ | — | Array of groups associated with the connection |
2723
- | ​ ↳ `members` | `string` | ❌ | — | Members associated with the connection |
2724
- | ​ ↳ `permissions` | `object` | ❌ | — | Permissions for the connection |
2725
- | ​ ↳ `public_id` | `string` | ❌ | — | Public UUID for the connection |
2726
- | ​ ↳ `account_public_id` | `string` | ❌ | — | Public UUID for the associated account |
2727
- | ​ ↳ `customuser_public_id` | `string` | ❌ | — | Public UUID for the associated custom user |
2728
- | ​ ↳ `implementation_id` | `string` | ❌ | — | Implementation ID (was selected_api) |
2729
- | ​ ↳ `profile_id` | `string` | ❌ | — | Profile ID (was customuser_id) |
2730
- | ​ ↳ `is_expired` | `string` | ❌ | — | Whether the connection is expired (mapped from is_stale) |
2731
- | ​ ↳ `expired_at` | `string` | ❌ | — | Date when connection expired (mapped from marked_stale_at) |
2732
- | ​ ↳ `app_key` | `string` | ❌ | — | App Key extracted from implementation_id |
2733
- | ​ ↳ `app_version` | `string` | ❌ | — | App Version extracted from implementation_id |
2734
- | ​ ↳ `is_managed` | `boolean` | ❌ | — | Whether this connection is managed by account admins (no individual owner) |
2800
+ | Name | Type | Required | Possible Values | Description |
2801
+ | ---------------------------- | -------- | -------- | --------------- | ------------------------------------------------------------------------------------ |
2802
+ | `data` | `object` | ✅ | — | |
2803
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow version ID (UUID) |
2804
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
2805
+ | ​ ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
2806
+ | ​ ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this version's runs |
2807
+ | ​ ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this version (or null) |
2808
+ | ​ ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who published this version |
2809
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the version was published (ISO-8601) |
2810
+ | ​ ↳ `trigger` | `object` | ✅ | — | Trigger configuration persisted on this version, or null for webhook-only workflows. |
2811
+ | ​ ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this version (or null). |
2812
+ | ​ ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this version (or null). |
2735
2813
 
2736
2814
  **Example:**
2737
2815
 
2738
2816
  ```typescript
2739
- const { data: connection } = await zapier.findFirstConnection();
2817
+ const { data: workflowVersion } = await zapier.publishWorkflowVersion({
2818
+ workflow: "example-workflow",
2819
+ sourceFiles: {},
2820
+ });
2740
2821
  ```
2741
2822
 
2742
- #### `findUniqueConnection`
2823
+ #### `runDurable` 🧪 _experimental_
2743
2824
 
2744
- Find a unique connection matching the criteria
2825
+ Run a workflow's complete source-files map as a run-once durable run on code-substrate-runner (no deployed workflow required). Send every file the workflow needs, not only its entry point. Returns the run ID immediately; poll via getDurableRun for terminal status.
2745
2826
 
2746
2827
  **Parameters:**
2747
2828
 
2748
- | Name | Type | Required | Default | Possible Values | Description |
2749
- | ------------------- | --------- | -------- | ------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
2750
- | `options` | `object` | ✅ | — | — | |
2751
- | ​ ↳ `search` | `string` | ❌ | — | — | Search term to filter connections by title |
2752
- | ​ ↳ `title` | `string` | ❌ | — | — | Filter connections by exact title match (searches first, then filters locally) |
2753
- | ​ ↳ `owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own connections or a specific user ID |
2754
- | ​ ↳ `app` | `string` | ❌ | — | — | App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github') |
2755
- | ​ ↳ `account` | `string` | ❌ | — | — | Account to filter by |
2756
- | ​ ↳ `includeShared` | `boolean` | ❌ | — | — | Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections. |
2757
- | ​ ↳ `status` | `string` | ❌ | — | `active`, `expired`, `all` | Filter connections by expiry: 'active' (default) returns only non-expired connections, 'expired' only expired ones, and 'all' returns both. |
2829
+ | Name | Type | Required | Default | Possible Values | Description |
2830
+ | -------------------------- | ---------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2831
+ | `options` | `object` | ✅ | — | — | |
2832
+ | ​ ↳ `sourceFiles` | `object` | ✅ | — | — | Source files keyed by filename → contents |
2833
+ | ​ ↳ `input` | `unknown` | ❌ | — | — | Input data passed to the run. Accepts any JSON value, or its JSON-string encoding. |
2834
+ | ​ ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies. A version of "latest" is resolved by the server for @zapier/zapier-durable and @zapier/zapier-sdk only; every other value, including a "latest" on any other package, is passed to the install as written. |
2835
+ | ​ ↳ `zapierDurableVersion` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"), or "latest". Defaults to the server-configured version if omitted. "latest" is resolved by the server to the newest release old enough to clear the sandbox install age gate (24h) -- this is not npm's "latest" tag, which can point at a release too new to install. Ranges (^1.2.3, ~1.2) are rejected. |
2836
+ | ​ ↳ `connections` | `object` | ❌ | — | — | Named connection aliases. Maps each alias to an object holding its Zapier connection ID, e.g. `{ "slack": { "connectionId": "123" } }`. |
2837
+ | ​ ↳ `appVersions` | `object` | ❌ | — | — | Pinned app versions. Maps app keys (slugs) to implementation names and versions. |
2838
+ | ​ ↳ `private` | `boolean` | ❌ | — | — | Only the creating user can see the run (default false) |
2839
+ | ​ ↳ `notifications[]` | `object[]` | ❌ | — | — | Webhook subscribers for run lifecycle events. Each entry specifies a URL and the events it subscribes to. |
2840
+ | ​   ↳ `type` | `string` | ❌ | — | `webhook` | Notification transport. Webhook is the only supported type. |
2841
+ | ​   ↳ `url` | `string` | ✅ | — | — | URL to POST event notifications to. Payload is `{run_id, event}`. |
2842
+ | ​   ↳ `max_retries` | `number` | ❌ | — | — | Max delivery attempts with exponential backoff. Defaults to 3 server-side. |
2843
+ | ​   ↳ `events` | `array` | ✅ | — | — | One or more lifecycle events to subscribe this URL to. |
2758
2844
 
2759
- **Returns:** `Promise<ConnectionItem>`
2845
+ **Returns:** `Promise<DurableRunItem>`
2760
2846
 
2761
- | Name | Type | Required | Possible Values | Description |
2762
- | ------------------------------ | --------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
2763
- | `data` | `object` | ✅ | — | |
2764
- | ​ ↳ `id` | `string` | ✅ | — | Unique identifier for the connection |
2765
- | ​ ↳ `date` | `string` | ✅ | — | Date created |
2766
- | ​ ↳ `lastchanged` | `string` | ❌ | — | Date last changed |
2767
- | ​ ↳ `account_id` | `string` | ✅ | — | Account ID associated with this connection |
2768
- | ​ ↳ `slug` | `string` | ❌ | — | Human-readable app slug for this connection's integration (e.g. 'google-sheets'). Null when no slug is registered for the app. |
2769
- | ​ ↳ `destination_selected_api` | `string` | ❌ | — | Destination API key (if applicable) |
2770
- | ​ ↳ `is_invite_only` | `boolean` | ✅ | — | Whether the connection is invite-only |
2771
- | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the connection is private |
2772
- | ​ ↳ `shared_with_all` | `boolean` | ✅ | — | Whether the connection is shared with all users |
2773
- | ​ ↳ `is_stale` | `string` | ❌ | — | Stale status string |
2774
- | ​ ↳ `is_shared` | `string` | ❌ | — | Shared status string |
2775
- | ​ ↳ `marked_stale_at` | `string` | ❌ | — | Date when marked stale |
2776
- | ​ ↳ `label` | `string` | ❌ | — | User label for the connection |
2777
- | ​ ↳ `identifier` | `string` | ❌ | — | Identifier |
2778
- | ​ ↳ `title` | `string` | ❌ | — | Title of the connection |
2779
- | ​ ↳ `url` | `string` | ❌ | — | URL to the connection resource |
2780
- | ​ ↳ `groups` | `array` | ❌ | — | Array of groups associated with the connection |
2781
- | ​ ↳ `members` | `string` | ❌ | — | Members associated with the connection |
2782
- | ​ ↳ `permissions` | `object` | ❌ | — | Permissions for the connection |
2783
- | ​ ↳ `public_id` | `string` | ❌ | — | Public UUID for the connection |
2784
- | ​ ↳ `account_public_id` | `string` | ❌ | — | Public UUID for the associated account |
2785
- | ​ ↳ `customuser_public_id` | `string` | ❌ | — | Public UUID for the associated custom user |
2786
- | ​ ↳ `implementation_id` | `string` | ❌ | — | Implementation ID (was selected_api) |
2787
- | ​ ↳ `profile_id` | `string` | ❌ | — | Profile ID (was customuser_id) |
2788
- | ​ ↳ `is_expired` | `string` | ❌ | — | Whether the connection is expired (mapped from is_stale) |
2789
- | ​ ↳ `expired_at` | `string` | ❌ | — | Date when connection expired (mapped from marked_stale_at) |
2790
- | ​ ↳ `app_key` | `string` | ❌ | — | App Key extracted from implementation_id |
2791
- | ​ ↳ `app_version` | `string` | ❌ | — | App Version extracted from implementation_id |
2792
- | ​ ↳ `is_managed` | `boolean` | ❌ | — | Whether this connection is managed by account admins (no individual owner) |
2847
+ | Name | Type | Required | Possible Values | Description |
2848
+ | ---------------- | --------- | -------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
2849
+ | `data` | `object` | ✅ | — | |
2850
+ | ​ ↳ `id` | `string` | ✅ | — | Run ID (UUID) — server-generated, time-sortable |
2851
+ | ​ ↳ `status` | `string` | ✅ | `initialized` | Always `initialized` on creation. Poll via getDurableRun to observe the run advancing to `started` / `finished` / `failed` / `cancelled`. |
2852
+ | ​ ↳ `is_private` | `boolean` | ✅ | — | When true, the run is visible only to the creating user; otherwise visible across the account. |
2853
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
2793
2854
 
2794
2855
  **Example:**
2795
2856
 
2796
2857
  ```typescript
2797
- const { data: connection } = await zapier.findUniqueConnection();
2858
+ const { data: durableRun } = await zapier.runDurable({
2859
+ sourceFiles: {},
2860
+ });
2798
2861
  ```
2799
2862
 
2800
- #### `getConnection`
2863
+ #### `runWorkflowDraft` 🧪 _experimental_
2801
2864
 
2802
- Get details for a specific connection
2865
+ Launch a draft test run: execute the draft's current source without publishing it. The draft's payload is snapshotted onto the run at creation, so later edits (or discarding the draft) never change what the run executed. Draft runs are free (not task-charged) and rate limited per user. The run is accepted asynchronously — it comes back `initialized`; follow it with `getWorkflowRun`, or list it via `listWorkflowRuns` with `kind: "draft"`.
2803
2866
 
2804
2867
  **Parameters:**
2805
2868
 
2806
- | Name | Type | Required | Default | Possible Values | Description |
2807
- | ---------------- | ---------------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2808
- | `options` | `object` | ✅ | — | — | |
2809
- | ​ ↳ `connection` | `string, number` | ✅ | — | — | Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. |
2869
+ | Name | Type | Required | Default | Possible Values | Description |
2870
+ | ------------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
2871
+ | `options` | `object` | ✅ | — | — | |
2872
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2873
+ | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
2874
+ | ​ ↳ `draftRevision` | `number` | ✅ | — | — | The draft revision you intend to run, from the last read of the draft. The server rejects the run with a conflict if the draft has changed since. The upstream API treats this check as optional; the SDK requires it so a test run can never silently execute source the caller has already replaced. |
2875
+ | ​ ↳ `input` | `unknown` | ❌ | — | — | Input data passed to the workflow. Accepts any JSON value, or its JSON-string encoding. Omit for a workflow that takes no input. |
2810
2876
 
2811
- **Returns:** `Promise<ConnectionItem>`
2877
+ **Returns:** `Promise<RunWorkflowDraftResponse>`
2812
2878
 
2813
- | Name | Type | Required | Possible Values | Description |
2814
- | ------------------------------ | --------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
2815
- | `data` | `object` | ✅ | — | |
2816
- | ​ ↳ `id` | `string` | ✅ | — | Unique identifier for the connection |
2817
- | ​ ↳ `date` | `string` | ✅ | — | Date created |
2818
- | ​ ↳ `lastchanged` | `string` | ❌ | — | Date last changed |
2819
- | ​ ↳ `account_id` | `string` | ✅ | — | Account ID associated with this connection |
2820
- | ​ ↳ `slug` | `string` | ❌ | — | Human-readable app slug for this connection's integration (e.g. 'google-sheets'). Null when no slug is registered for the app. |
2821
- | ​ ↳ `destination_selected_api` | `string` | ❌ | — | Destination API key (if applicable) |
2822
- | ​ ↳ `is_invite_only` | `boolean` | ✅ | — | Whether the connection is invite-only |
2823
- | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the connection is private |
2824
- | ​ ↳ `shared_with_all` | `boolean` | ✅ | — | Whether the connection is shared with all users |
2825
- | ​ ↳ `is_stale` | `string` | ❌ | — | Stale status string |
2826
- | ​ ↳ `is_shared` | `string` | ❌ | — | Shared status string |
2827
- | ​ ↳ `marked_stale_at` | `string` | ❌ | — | Date when marked stale |
2828
- | ​ ↳ `label` | `string` | ❌ | — | User label for the connection |
2829
- | ​ ↳ `identifier` | `string` | ❌ | — | Identifier |
2830
- | ​ ↳ `title` | `string` | ❌ | — | Title of the connection |
2831
- | ​ ↳ `url` | `string` | ❌ | — | URL to the connection resource |
2832
- | ​ ↳ `groups` | `array` | ❌ | — | Array of groups associated with the connection |
2833
- | ​ ↳ `members` | `string` | ❌ | — | Members associated with the connection |
2834
- | ​ ↳ `permissions` | `object` | ❌ | — | Permissions for the connection |
2835
- | ​ ↳ `public_id` | `string` | ❌ | — | Public UUID for the connection |
2836
- | ​ ↳ `account_public_id` | `string` | ❌ | — | Public UUID for the associated account |
2837
- | ​ ↳ `customuser_public_id` | `string` | ❌ | — | Public UUID for the associated custom user |
2838
- | ​ ↳ `implementation_id` | `string` | ❌ | — | Implementation ID (was selected_api) |
2839
- | ​ ↳ `profile_id` | `string` | ❌ | — | Profile ID (was customuser_id) |
2840
- | ​ ↳ `is_expired` | `string` | ❌ | — | Whether the connection is expired (mapped from is_stale) |
2841
- | ​ ↳ `expired_at` | `string` | ❌ | — | Date when connection expired (mapped from marked_stale_at) |
2842
- | ​ ↳ `app_key` | `string` | ❌ | — | App Key extracted from implementation_id |
2843
- | ​ ↳ `app_version` | `string` | ❌ | — | App Version extracted from implementation_id |
2844
- | ​ ↳ `is_managed` | `boolean` | ❌ | — | Whether this connection is managed by account admins (no individual owner) |
2879
+ | Name | Type | Required | Possible Values | Description |
2880
+ | ----------------------- | --------- | -------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
2881
+ | `data` | `object` | ✅ | — | |
2882
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow run ID (UUIDv7). Unique across live and draft runs. |
2883
+ | ​ ↳ `kind` | `string` | ✅ | `draft` | A run launched from a workflow draft. |
2884
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow this run belongs to |
2885
+ | ​ ↳ `durable_run_id` | `string` | ✅ | — | Linked code-substrate-runner run ID. Usually still null in this response — the run is accepted and launched in the background. |
2886
+ | ​ ↳ `workflow_draft_id` | `string` | ✅ | — | The draft this run was launched from. Becomes null once that draft is deleted — the run outlives its draft. |
2887
+ | ​ ↳ `draft_revision` | `number` | ✅ | — | The draft's revision at the moment this run was created. |
2888
+ | ​ ↳ `status` | `string` | ✅ | `initialized`, `started`, `finished`, `failed`, `cancelled` | Workflow run lifecycle status. `finished` / `failed` / `cancelled` are terminal. |
2889
+ | ​ ↳ `input` | `unknown` | ✅ | — | Input passed to the run |
2890
+ | ​ ↳ `output` | `unknown` | ✅ | — | Return value, present when status is `finished` |
2891
+ | ​ ↳ `error` | `unknown` | ✅ | — | Error payload when status is `failed` (null otherwise) |
2892
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the run was created (ISO-8601) |
2893
+ | ​ ↳ `updated_at` | `string` | ✅ | — | When the run was last updated (ISO-8601) |
2845
2894
 
2846
2895
  **Example:**
2847
2896
 
2848
2897
  ```typescript
2849
- const { data: connection } = await zapier.getConnection({
2850
- connection: "example-connection",
2898
+ const { data: workflowRun } = await zapier.runWorkflowDraft({
2899
+ workflow: "example-workflow",
2900
+ draft: "example-draft",
2901
+ draftRevision: 100,
2851
2902
  });
2852
2903
  ```
2853
2904
 
2854
- #### `getConnectionStartUrl`
2855
-
2856
- Mint a short-lived URL that begins an SDK-initiated connection flow. The URL is signed by zapier.com and bound to the current user/account — opening it in a different browser session will fail the binding check. Returns the URL as data so the caller decides what to do with it.
2857
-
2858
- Use this directly (rather than the higher-level `create-connection`) when you want either of: (a) hand off the URL and _not_ block waiting for completion — call this alone, skip `wait-for-new-connection` entirely, or (b) do something custom between minting the URL and waiting for the connection — call this, then email or DM the URL, render it as a QR code for mobile sign-in, etc., then call `wait-for-new-connection`. For the common case where you'd just print and poll back-to-back, `create-connection` is one call.
2859
-
2860
- Pair with `wait-for-new-connection` to detect completion: pass the `startedAt` returned here straight through (it's the server's mint time, so polling isn't affected by client clock skew). Example (JS):
2905
+ #### `triggerWorkflow` 🧪 _experimental_
2861
2906
 
2862
- ```ts
2863
- const {
2864
- data: { url, app, startedAt },
2865
- } = await zapier.getConnectionStartUrl({ app: "slack" });
2866
- // hand `url` off — print it, DM it, email it, render a button, whatever
2867
- const { data: conn } = await zapier.waitForNewConnection({ app, startedAt });
2868
- ```
2907
+ Look up a workflow's trigger URL and fire it manually, as the authenticated account.
2869
2908
 
2870
2909
  **Parameters:**
2871
2910
 
2872
- | Name | Type | Required | Default | Possible Values | Description |
2873
- | --------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------ |
2874
- | `options` | `object` | ✅ | — | — | |
2875
- | ​ ↳ `app` | `string` | ✅ | — | — | App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3') |
2911
+ | Name | Type | Required | Default | Possible Values | Description |
2912
+ | -------------- | --------- | -------- | ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2913
+ | `options` | `object` | ✅ | — | — | |
2914
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
2915
+ | ​ ↳ `input` | `unknown` | ❌ | — | — | JSON payload delivered as the trigger body. Accepts any JSON value, or its JSON-string encoding. Sent as `application/json`; omit to fire with an empty body. |
2876
2916
 
2877
- **Returns:** `Promise<ConnectionStartUrlItem>`
2917
+ **Returns:** `Promise<WorkflowRunItem>`
2878
2918
 
2879
- | Name | Type | Required | Possible Values | Description |
2880
- | --------------- | -------- | -------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2881
- | `data` | `object` | ✅ | — | |
2882
- | ​ ↳ `url` | `string` | ✅ | — | URL the user should open in their browser to complete the auth flow. Single-use, time-limited. |
2883
- | ​ ↳ `expiresAt` | `number` | ✅ | — | Unix timestamp (seconds) after which the URL's signature is rejected by zapier.com. |
2884
- | ​ ↳ `startedAt` | `number` | ✅ | — | Unix timestamp (seconds) when the server minted the URL. Use it as the `startedAt` for `wait-for-new-connection` so polling is anchored to server time rather than a possibly-skewed client clock. |
2885
- | ​ ↳ `app` | `string` | ✅ | — | Versionless app key the URL was minted for (e.g., 'SlackCLIAPI'). Useful for downstream filtering. |
2919
+ | Name | Type | Required | Possible Values | Description |
2920
+ | ----------------- | -------- | -------- | --------------- | ---------------------------------------- |
2921
+ | `data` | `object` | ✅ | — | |
2922
+ | ​ ↳ `id` | `string` | ✅ | — | Trigger ID (UUID) |
2923
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow that was triggered (UUID) |
2924
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the trigger was received (ISO-8601) |
2886
2925
 
2887
2926
  **Example:**
2888
2927
 
2889
2928
  ```typescript
2890
- const { data: connectionStartUrl } = await zapier.getConnectionStartUrl({
2891
- app: "example-app",
2929
+ const { data: workflowRun } = await zapier.triggerWorkflow({
2930
+ workflow: "example-workflow",
2892
2931
  });
2893
2932
  ```
2894
2933
 
2895
- #### `listConnections`
2934
+ #### `updateAgenticManagementConfig` 🧪 _experimental_
2896
2935
 
2897
- List available connections with optional filtering
2936
+ Change the modes a workflow runs, whether fixes are applied without approval, or both. A `modes` list replaces the whole current set rather than adding to it.
2898
2937
 
2899
2938
  **Parameters:**
2900
2939
 
2901
- | Name | Type | Required | Default | Possible Values | Description |
2902
- | ------------------- | --------- | -------- | ------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
2903
- | `options` | `object` | ✅ | — | — | |
2904
- | ​ ↳ `search` | `string` | ❌ | — | — | Search term to filter connections by title |
2905
- | ​ ↳ `title` | `string` | ❌ | — | — | Filter connections by exact title match (searches first, then filters locally) |
2906
- | ​ ↳ `owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own connections or a specific user ID |
2907
- | ​ ↳ `app` | `string` | ❌ | — | — | App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github') |
2908
- | ​ ↳ `connections` | `array` | ❌ | — | — | List of connection IDs to filter by |
2909
- | ​ ↳ `account` | `string` | ❌ | — | — | Account to filter by |
2910
- | ​ ↳ `includeShared` | `boolean` | ❌ | — | — | Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections. |
2911
- | ​ ↳ `status` | `string` | ❌ | — | `active`, `expired`, `all` | Filter connections by expiry: 'active' (default) returns only non-expired connections, 'expired' only expired ones, and 'all' returns both. |
2912
- | ​ ↳ `pageSize` | `number` | ❌ | — | — | Number of connections per page. The upstream API may cap this and reject values above its limit. |
2913
- | ​ ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
2914
- | ​ ↳ `cursor` | `string` | ❌ | — | — | Cursor to start from |
2940
+ | Name | Type | Required | Default | Possible Values | Description |
2941
+ | ----------------- | --------- | -------- | ------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2942
+ | `options` | `object` | ✅ | — | — | |
2943
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to update. |
2944
+ | ​ ↳ `modes` | `array` | ❌ | — | — | The modes to run. The list you pass replaces the whole current set in one step; it is not added to what is already active. Omit it to leave the active modes as they are. A mode is what Agentic Management watches for and what it changes in response. `heal` monitors runs for errors and, when something breaks, diagnoses the cause and drafts and tests a fix; it is the mode a workflow gets by default. `expand` grows what the workflow covers: it reviews runs that succeeded without actually doing anything — a lookup that matched nothing, a filter that passed no items, a trigger payload no branch handles — and proposes a new branch or step to handle that case, rather than rewriting the ones that already work. `harden` watches the AI steps: when an AI step keeps doing the same work the same way, it converts that step into fixed code, so the workflow runs faster, costs less, and behaves the same way every time. Modes stack — each one you name runs alongside the others, and a mode you leave out does nothing, so a workflow on `expand` alone does not repair failed runs. Whether a change goes live on its own or waits for someone to approve it is `autoApprove`, not the mode. |
2945
+ | ​ ↳ `autoApprove` | `boolean` | ❌ | — | — | Apply the fixes Agentic Management proposes without asking first. Set it to false and each fix waits for someone to approve it before anything changes. Omit it to leave the current setting alone. |
2915
2946
 
2916
- **Returns:** `Promise<PaginatedResult<ConnectionItem>>`
2947
+ **Returns:** `Promise<AgenticManagementConfigItem>`
2917
2948
 
2918
- | Name | Type | Required | Possible Values | Description |
2919
- | ------------------------------ | ---------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
2920
- | `data[]` | `object[]` | ✅ | — | |
2921
- | ​ ↳ `id` | `string` | ✅ | — | Unique identifier for the connection |
2922
- | ​ ↳ `date` | `string` | ✅ | — | Date created |
2923
- | ​ ↳ `lastchanged` | `string` | ❌ | — | Date last changed |
2924
- | ​ ↳ `account_id` | `string` | ✅ | — | Account ID associated with this connection |
2925
- | ​ ↳ `slug` | `string` | ❌ | — | Human-readable app slug for this connection's integration (e.g. 'google-sheets'). Null when no slug is registered for the app. |
2926
- | ​ ↳ `destination_selected_api` | `string` | ❌ | — | Destination API key (if applicable) |
2927
- | ​ ↳ `is_invite_only` | `boolean` | ✅ | — | Whether the connection is invite-only |
2928
- | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the connection is private |
2929
- | ​ ↳ `shared_with_all` | `boolean` | ✅ | — | Whether the connection is shared with all users |
2930
- | ​ ↳ `is_stale` | `string` | ❌ | — | Stale status string |
2931
- | ​ ↳ `is_shared` | `string` | ❌ | — | Shared status string |
2932
- | ​ ↳ `marked_stale_at` | `string` | ❌ | — | Date when marked stale |
2933
- | ​ ↳ `label` | `string` | ❌ | — | User label for the connection |
2934
- | ​ ↳ `identifier` | `string` | ❌ | — | Identifier |
2935
- | ​ ↳ `title` | `string` | ❌ | — | Title of the connection |
2936
- | ​ ↳ `url` | `string` | ❌ | — | URL to the connection resource |
2937
- | ​ ↳ `groups` | `array` | ❌ | — | Array of groups associated with the connection |
2938
- | ​ ↳ `members` | `string` | ❌ | — | Members associated with the connection |
2939
- | ​ ↳ `permissions` | `object` | ❌ | — | Permissions for the connection |
2940
- | ​ ↳ `public_id` | `string` | ❌ | — | Public UUID for the connection |
2941
- | ​ ↳ `account_public_id` | `string` | ❌ | — | Public UUID for the associated account |
2942
- | ​ ↳ `customuser_public_id` | `string` | ❌ | — | Public UUID for the associated custom user |
2943
- | ​ ↳ `implementation_id` | `string` | ❌ | — | Implementation ID (was selected_api) |
2944
- | ​ ↳ `profile_id` | `string` | ❌ | — | Profile ID (was customuser_id) |
2945
- | ​ ↳ `is_expired` | `string` | ❌ | — | Whether the connection is expired (mapped from is_stale) |
2946
- | ​ ↳ `expired_at` | `string` | ❌ | — | Date when connection expired (mapped from marked_stale_at) |
2947
- | ​ ↳ `app_key` | `string` | ❌ | — | App Key extracted from implementation_id |
2948
- | ​ ↳ `app_version` | `string` | ❌ | — | App Version extracted from implementation_id |
2949
- | ​ ↳ `is_managed` | `boolean` | ❌ | — | Whether this connection is managed by account admins (no individual owner) |
2950
- | `nextCursor` | `string` | ❌ | — | Cursor for the next page; omitted when there are no more pages |
2949
+ | Name | Type | Required | Possible Values | Description |
2950
+ | ------------------ | --------- | -------- | --------------- | ------------------------------------------------------------- |
2951
+ | `data` | `object` | ✅ | — | |
2952
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow whose config was updated. |
2953
+ | ​ ↳ `modes` | `array` | ✅ | — | The modes the workflow runs after this update. |
2954
+ | ​ ↳ `auto_approve` | `boolean` | ✅ | — | Whether fixes are applied without approval after this update. |
2951
2955
 
2952
2956
  **Example:**
2953
2957
 
2954
2958
  ```typescript
2955
- // Get first page and a cursor for the second page
2956
- const { data: connections, nextCursor } = await zapier.listConnections();
2959
+ const { data: agenticManagementConfig } =
2960
+ await zapier.updateAgenticManagementConfig({
2961
+ workflow: "example-workflow",
2962
+ });
2963
+ ```
2957
2964
 
2958
- // Or iterate over all pages
2959
- for await (const page of zapier.listConnections().pages()) {
2960
- // Do something with each page
2961
- }
2965
+ #### `updateAgenticManagementIntent` 🧪 _experimental_
2962
2966
 
2963
- // Or iterate over individual items across all pages
2964
- for await (const connection of zapier.listConnections().items()) {
2965
- // Do something with each connection
2966
- }
2967
- ```
2967
+ Record what one workflow version is meant to do. Writing again for the same version replaces the text already stored, so there is no separate create and update.
2968
2968
 
2969
- #### `waitForNewConnection`
2969
+ **Parameters:**
2970
2970
 
2971
- Wait for a new connection to appear for the given app. Polls the connections list newest-first until the most recent matching row's `date` is at or after the started-at timestamp, then returns it. Pair with `get-connection-start-url` — that mints the URL the user opens, this waits for the resulting connection to land. Errors with a timeout after the configured timeout (default 5 min). Example (JS):
2971
+ | Name | Type | Required | Default | Possible Values | Description |
2972
+ | -------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2973
+ | `options` | `object` | ✅ | — | — | |
2974
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | ID of the workflow to write to. |
2975
+ | ​ ↳ `intent` | `string` | ✅ | — | — | What this version of the workflow is for, in your own words: the outcome it produces, what sets it off, and anything that must always hold true. Plain prose, not code. |
2976
+ | ​ ↳ `version` | `string` | ❌ | — | — | The workflow version the intent belongs to. Each version stores its own intent, and a version never picks up the intent of another, so publishing a new version starts it with none. Omit this to use the workflow's current published version. |
2972
2977
 
2973
- ```ts
2974
- const {
2975
- data: { url, app, startedAt },
2976
- } = await zapier.getConnectionStartUrl({ app: "slack" });
2977
- // show `url` to the user via the channel they're reading from
2978
- const { data: conn } = await zapier.waitForNewConnection({ app, startedAt });
2978
+ **Returns:** `Promise<AgenticManagementIntentItem>`
2979
+
2980
+ | Name | Type | Required | Possible Values | Description |
2981
+ | ------------------------- | -------- | -------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2982
+ | `data` | `object` | ✅ | — | |
2983
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | The workflow the intent belongs to. |
2984
+ | ​ ↳ `workflow_version_id` | `string` | ✅ | — | The version this read or write actually landed on, so you can tell which one answered when you omitted `version`. `null` only when you read a workflow that has nothing published yet. |
2985
+ | ​ ↳ `intent` | `string` | ✅ | — | The intent stored for this version, or `null` when this version has none. Intent is never carried over from another version. |
2986
+ | ​ ↳ `updated_at` | `string` | ❌ | — | When the intent was last written; `null` when never captured. |
2987
+
2988
+ **Example:**
2989
+
2990
+ ```typescript
2991
+ const { data: agenticManagementIntent } =
2992
+ await zapier.updateAgenticManagementIntent({
2993
+ workflow: "example-workflow",
2994
+ intent: "example-intent",
2995
+ });
2979
2996
  ```
2980
2997
 
2998
+ #### `updateWorkflow` 🧪 _experimental_
2999
+
3000
+ Update a durable workflow's name and/or description
3001
+
2981
3002
  **Parameters:**
2982
3003
 
2983
- | Name | Type | Required | Default | Possible Values | Description |
2984
- | ------------------------------ | -------- | -------- | ------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2985
- | `options` | `object` | ✅ | — | — | |
2986
- | ​ ↳ `app` | `string` | ✅ | — | — | App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3') |
2987
- | ​ ↳ `startedAt` | `number` | ✅ | — | — | Unix timestamp (seconds). Only connections whose `date` is at or after this value count as 'new'. Prefer the `startedAt` returned by `get-connection-start-url` — it's server-stamped, so the comparison isn't thrown off by client clock skew. If you mint the timestamp yourself, capture it _before_ showing the start URL so a fast OAuth completion isn't missed. |
2988
- | ​ ↳ `timeoutSeconds` | `number` | ❌ | — | — | How long to wait before giving up. Default 5 minutes (300). |
2989
- | ​ ↳ `pollIntervalMilliseconds` | `number` | ❌ | — | — | Delay before the first poll request, in ms. Default 3 seconds (3_000). Subsequent polling cadence is managed by the SDK's polling primitive (backoff with sane defaults). |
3004
+ | Name | Type | Required | Default | Possible Values | Description |
3005
+ | ----------------- | -------- | -------- | ------- | --------------- | ----------------------------------------------------- |
3006
+ | `options` | `object` | ✅ | — | — | |
3007
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
3008
+ | ​ ↳ `name` | `string` | ❌ | — | — | New name for the workflow |
3009
+ | ​ ↳ `description` | `string` | ❌ | — | — | New description for the workflow (pass null to clear) |
2990
3010
 
2991
- **Returns:** `Promise<ConnectionItem>`
3011
+ **Returns:** `Promise<WorkflowItem>`
2992
3012
 
2993
- | Name | Type | Required | Possible Values | Description |
2994
- | ----------- | -------- | -------- | --------------- | ------------------------------------------------------------------------------------ |
2995
- | `data` | `object` | ✅ | — | |
2996
- | ​ ↳ `id` | `string` | ✅ | — | The new connection's ID. Public UUID when available, falling back to the numeric ID. |
2997
- | ​ ↳ `app` | `string` | ✅ | — | Versionless app key the connection was created for (e.g., 'SlackCLIAPI'). |
2998
- | ​ ↳ `title` | `string` | ❌ | — | Human-readable connection title set by the auth flow, when available. |
3013
+ | Name | Type | Required | Possible Values | Description |
3014
+ | ------------------------ | --------- | -------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3015
+ | `data` | `object` | ✅ | — | |
3016
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow ID (UUID) |
3017
+ | ​ ↳ `name` | `string` | ✅ | — | Workflow name (post-update) |
3018
+ | ​ ↳ `description` | `string` | ✅ | — | Workflow description, post-update (null if unset) |
3019
+ | ​ ↳ `trigger_url` | `string` | ✅ | — | Public URL that fires this workflow when POSTed to. Embeds a trigger token in the path — treat as sensitive. Requests must also be authenticated as the account. |
3020
+ | ​ ↳ `editor_url` | `string` | ✅ | — | URL to the Zapier workflow editor for this workflow |
3021
+ | ​ ↳ `enabled` | `boolean` | ✅ | — | Whether the workflow currently accepts triggers |
3022
+ | ​ ↳ `is_private` | `boolean` | ✅ | — | Whether the workflow is private to the creating user. False means account-visible. |
3023
+ | ​ ↳ `created_by_user_id` | `string` | ✅ | — | User ID of the workflow creator (null in legacy data) |
3024
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the workflow was created (ISO-8601) |
3025
+ | ​ ↳ `updated_at` | `string` | ✅ | — | When this update was applied (ISO-8601) |
2999
3026
 
3000
3027
  **Example:**
3001
3028
 
3002
3029
  ```typescript
3003
- const { data: connection } = await zapier.waitForNewConnection({
3004
- app: "example-app",
3005
- startedAt: 100,
3030
+ const { data: workflow } = await zapier.updateWorkflow({
3031
+ workflow: "example-workflow",
3006
3032
  });
3007
3033
  ```
3008
3034
 
3009
- ### HTTP Requests
3010
-
3011
- #### `fetch`
3035
+ #### `updateWorkflowDraft` 🧪 _experimental_
3012
3036
 
3013
- Make authenticated HTTP requests to any API through Zapier. Pass a connectionId to automatically inject the user's stored credentials (OAuth tokens, API keys, etc.) into the outgoing request. Mirrors the native fetch(url, init?) signature with additional Zapier-specific options.
3037
+ Update (autosave) an open workflow draft
3014
3038
 
3015
3039
  **Parameters:**
3016
3040
 
3017
- | Name | Type | Required | Default | Possible Values | Description |
3018
- | -------------------- | ------------------------ | -------- | ------- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3019
- | `url` | `string, custom` | ✅ | — | — | The full URL of the API endpoint to call (proxied through Zapier's API Proxy) |
3020
- | `init` | `object` | ❌ | — | — | Request options including method, headers, body, and authentication |
3021
- | ​ ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method for the request (defaults to GET) |
3022
- | ​ ↳ `headers` | `object` | ❌ | — | — | HTTP headers to include in the request |
3023
- | ​ ↳ `body` | `string, custom, record` | ❌ | — | — | Request body — plain objects and JSON strings are auto-detected and Content-Type is set accordingly |
3024
- | ​ ↳ `connection` | `string, number` | ❌ | — | — | Connection alias or connection ID (UUID or positive integer). Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly. |
3025
- | ​ ↳ `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
3026
- | ​ ↳ `idempotencyKey` | `string` | ❌ | — | — | Key used to make API Proxy retries safe from duplicate side effects |
3027
- | ​ ↳ `maxTimeSeconds` | `number` | ❌ | — | — | Maximum seconds to wait for a response. Honored on a best-effort basis; the server may silently enforce a lower ceiling. |
3041
+ | Name | Type | Required | Default | Possible Values | Description |
3042
+ | -------------------------- | --------- | -------- | ------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3043
+ | `options` | `object` | ✅ | — | — | |
3044
+ | ​ ↳ `workflow` | `string` | ✅ | — | — | Durable workflow ID |
3045
+ | ​ ↳ `draft` | `string` | ✅ | — | — | Workflow draft ID |
3046
+ | ​ ↳ `sourceFiles` | `object` | ✅ | — | — | Source files keyed by filename → contents |
3047
+ | ​ ↳ `zapierDurableVersion` | `string` | ❌ | — | — | Exact semver of @zapier/zapier-durable to use (e.g. "1.2.3"), or "latest". Leaves the stored pin unchanged if omitted. A draft stores what you pass verbatim, so "latest" is recorded as-is and resolved to an exact version when the draft is published -- reading the draft back shows "latest", not a version. Ranges (^1.2.3, ~1.2) are rejected at publish. |
3048
+ | ​ ↳ `dependencies` | `object` | ❌ | — | — | Optional npm package dependencies. A version of "latest" is resolved by the server for @zapier/zapier-durable and @zapier/zapier-sdk only; every other value, including a "latest" on any other package, is passed to the install as written. |
3049
+ | ​ ↳ `draftRevision` | `number` | ❌ | — | — | Expected draft revision for optimistic concurrency. Pass the revision from the last read; the server rejects the save with a conflict if the draft has changed since. Omit to skip the check. |
3050
+ | ​ ↳ `trigger` | `object` | ❌ | — | — | Trigger configuration. Omit to leave the stored trigger unchanged, pass null to clear it, or pass an object to replace it; for an on-demand, triggerless workflow, clear this and pass `manual: true` instead. |
3051
+ | ​ ↳ `connections` | `object` | ❌ | — | — | Map of connection aliases to Zapier connections used by the workflow. Pass `null` to clear an existing binding. |
3052
+ | ​ ↳ `appVersions` | `object` | ❌ | — | — | Map of app keys to pinned app implementation/version used by the workflow. Pass `null` to clear an existing binding. |
3053
+ | ​ ↳ `manual` | `boolean` | ❌ | — | — | Declare this draft on-demand and triggerless. Pass `manual: true` only when omitting `trigger` (or clearing it with `trigger: null`); passing both is a contradiction the API rejects with a 400. Setting a `trigger` later clears a previously stored `manual: true`. |
3028
3054
 
3029
- **Returns:** `Promise<Response>`
3055
+ **Returns:** `Promise<WorkflowDraftItem>`
3056
+
3057
+ | Name | Type | Required | Possible Values | Description |
3058
+ | ---------------------------- | -------- | -------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
3059
+ | `data` | `object` | ✅ | — | |
3060
+ | ​ ↳ `id` | `string` | ✅ | — | Workflow draft ID (UUID) |
3061
+ | ​ ↳ `workflow_id` | `string` | ✅ | — | Parent workflow ID (UUID) |
3062
+ | ​ ↳ `slug` | `string` | ✅ | — | Human-friendly display name, not an identifier: two open drafts of a workflow may share one |
3063
+ | ​ ↳ `base_version_id` | `string` | ✅ | — | The version this draft was forked from (the live version at draft creation), or null when the workflow had no published version yet |
3064
+ | ​ ↳ `source_files` | `object` | ✅ | — | Source files keyed by filename → contents |
3065
+ | ​ ↳ `zapier_durable_version` | `string` | ✅ | — | Pinned semver of @zapier/zapier-durable used by this draft |
3066
+ | ​ ↳ `dependencies` | `object` | ✅ | — | Additional npm dependencies pinned for this draft (or null) |
3067
+ | ​ ↳ `draft_revision` | `number` | ✅ | — | Monotonic revision counter for optimistic concurrency. Echo it back on draft updates to detect concurrent edits. |
3068
+ | ​ ↳ `status` | `string` | ✅ | `open`, `discarded` | Lifecycle status of a workflow draft. |
3069
+ | ​ ↳ `created_by_user_id` | `string` | ✅ | — | ID of the user who created (forked) this draft |
3070
+ | ​ ↳ `last_edited_by_user_id` | `string` | ✅ | — | ID of the user who last saved this draft (or null) |
3071
+ | ​ ↳ `last_edited_at` | `string` | ✅ | — | When the draft was last edited (ISO-8601, or null) |
3072
+ | ​ ↳ `discarded_at` | `string` | ✅ | — | When the draft was discarded (ISO-8601), or null while open |
3073
+ | ​ ↳ `created_at` | `string` | ✅ | — | When the draft was created (ISO-8601) |
3074
+ | ​ ↳ `updated_at` | `string` | ✅ | — | When the draft row was last updated (ISO-8601) |
3075
+ | ​ ↳ `trigger` | `object` | ✅ | — | Trigger configuration held on this draft, or null for webhook-only workflows. |
3076
+ | ​ ↳ `connections` | `object` | ✅ | — | Connection aliases bound on this draft (or null). |
3077
+ | ​ ↳ `app_versions` | `object` | ✅ | — | App-version pins bound on this draft (or null). |
3030
3078
 
3031
3079
  **Example:**
3032
3080
 
3033
3081
  ```typescript
3034
- const result = await zapier.fetch("https://example.com", {});
3082
+ const { data: workflowDraft } = await zapier.updateWorkflowDraft({
3083
+ workflow: "example-workflow",
3084
+ draft: "example-draft",
3085
+ sourceFiles: {},
3086
+ });
3035
3087
  ```
3036
3088
 
3037
- ### Human Inputs (Experimental)
3038
-
3039
- > ℹ️ **Experimental.** Still being designed; may change shape or disappear in any release, without notice. Import from `"@zapier/zapier-sdk/experimental"` to use these methods.
3040
-
3041
- #### `createForm` 🧪 _experimental_
3089
+ #### `validateWorkflow` 🧪 _experimental_
3042
3090
 
3043
- Create a Zapier Form from a title and optional fields. Forms publish by default and return a shareable `hosted_url`; set `draft` to save without publishing.
3091
+ Validate durable workflow source without publishing it. Returns source diagnostics; issue kinds are extensible and may be unfamiliar to the client.
3044
3092
 
3045
3093
  **Parameters:**
3046
3094
 
3047
- | Name | Type | Required | Default | Possible Values | Description |
3048
- | ------------------------- | ---------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3049
- | `options` | `object` | ✅ | — | — | |
3050
- | ​ ↳ `title` | `string` | ✅ | — | — | The title shown in the Forms UI and on the form. |
3051
- | ​ ↳ `description` | `string` | ❌ | — | — | An optional description of the form. |
3052
- | ​ ↳ `fields[]` | `object[]` | ❌ | — | — | Initial fields to add to the form. |
3053
- | ​   ↳ `label` | `string` | ✅ | — | — | Human-readable label shown above the input. |
3054
- | ​   ↳ `type` | `string` | ✅ | — | `short_text`, `long_text`, `email`, `number`, `yes_no`, `url`, `date`, `date_range`, `currency`, `phone_number`, `dropdown`, `integration_backed` | The type of field. |
3055
- | ​   ↳ `required` | `boolean` | ❌ | — | — | Whether the field must be answered before the form can submit. |
3056
- | ​   ↳ `disabled` | `boolean` | ❌ | — | — | When true, the field is rendered read-only — shown but not editable. A rendering hint only; it is not enforced during submission validation. |
3057
- | ​   ↳ `variant` | `string` | ❌ | — | `checkbox`, `radio` | For `yes_no` fields: `checkbox` renders a single toggle, `radio` renders explicit yes/no buttons. Defaults to `checkbox`. |
3058
- | ​   ↳ `multiUrl` | `boolean` | ❌ | — | — | For `url` fields: when true the field accepts a list of URLs, otherwise a single URL. Defaults to false. |
3059
- | ​   ↳ `includeTime` | `boolean` | ❌ | — | — | For `date` and `date_range` fields: when true the picker also captures a time. Defaults to false. |
3060
- | ​   ↳ `currencyFormat` | `string` | ❌ | — | — | For `currency` fields: ISO 4217 currency code (e.g. `usd`, `eur`). Controls the symbol shown in the form UI. |
3061
- | ​   ↳ `decimals` | `literal` | ❌ | — | — | For `currency` fields: allowed decimal places. `0` for whole numbers, `2` for up to two decimal places. Defaults to `2`. |
3062
- | ​   ↳ `defaultCountry` | `string` | ❌ | — | — | For `phone_number` fields: ISO 3166-1 alpha-2 code for the default selected country (e.g. `US`). Defaults to `US`. |
3063
- | ​   ↳ `phoneNumberFormat` | `string` | ❌ | — | `national`, `international` | For `phone_number` fields: `national` omits the country-code prefix, `international` includes it. Defaults to `national`. |
3064
- | ​   ↳ `acceptedCountries` | `array` | ❌ | — | — | For `phone_number` fields: restrict input to specific ISO 3166-1 alpha-2 country codes. Omit to allow all countries. |
3065
- | ​   ↳ `options[]` | `object[]` | ❌ | — | — | For `dropdown` fields: the selectable options. At least one is required. |
3066
- | ​     ↳ `value` | `string` | ✅ | — | — | The value submitted when this option is selected. |
3067
- | ​     ↳ `label` | `string` | ✅ | — | — | Human-readable label shown to the user. |
3068
- | ​   ↳ `multiSelect` | `boolean` | ❌ | — | — | For `dropdown` fields: when true the user may select multiple options. Defaults to false. |
3069
- | ​   ↳ `dataSource` | `object` | ❌ | — | — | For `integration_backed` fields: where to fetch the field's options from at render time. |
3070
- | ​     ↳ `app` | `string` | ✅ | — | — | Zapier app to pull options from. See `listApps` for the catalog. |
3071
- | ​     ↳ `actionType` | `string` | ✅ | — | `read`, `read_bulk` | Whether the data source returns a single record (`read`) or a collection (`read_bulk`). |
3072
- | ​     ↳ `resource` | `string` | ✅ | — | — | Resource name within the app — typically a trigger or search key from the app's definition. |
3073
- | ​     ↳ `valueKey` | `string` | ❌ | — | — | Property on each returned record to use as the submitted option value. Defaults to `id`. |
3074
- | ​     ↳ `labelKey` | `string` | ❌ | — | — | Property on each returned record to use as the displayed option label. Defaults to a sensible name field. |
3075
- | ​ ↳ `draft` | `boolean` | ❌ | — | — | When true, save without publishing. Omit to publish immediately, making `hosted_url` live. |
3076
- | ​ ↳ `confirmationTitle` | `string` | ❌ | — | — | Heading shown to the respondent after they submit. Omit to use the form renderer's default. |
3077
- | ​ ↳ `confirmationMessage` | `string` | ❌ | — | — | Message shown to the respondent after they submit, below the confirmation title. Omit to use the form renderer's default. |
3078
- | ​ ↳ `callbackUrl` | `string` | ❌ | — | — | Absolute http/https URL notified with the submission JSON each time the form is answered. |
3079
- | ​ ↳ `consumerAuth` | `string` | ❌ | — | `none`, `zapier` | Who may open the published form. `none` (the default) leaves it public to anyone with the link; `zapier` requires the visitor to be signed in to Zapier on the form's owning account. |
3080
- | ​ ↳ `document` | `object` | ❌ | — | — | Escape hatch: a complete form document tree, sent as-is. When supplied it replaces the document built from `fields`, and `title`, `description`, `confirmationTitle`, and `confirmationMessage` are ignored. Use only for structures the flat field list cannot express, such as approval decisions or multi-column row layout. |
3081
- | ​   ↳ `id` | `string` | ✅ | — | — | |
3082
- | ​   ↳ `type` | `string` | ✅ | — | `root` | |
3083
- | ​   ↳ `attrs` | `object` | ✅ | — | — | |
3084
- | ​     ↳ `schema_version` | `number` | ✅ | — | — | |
3085
- | ​     ↳ `title` | `string` | ✅ | — | — | |
3086
- | ​   ↳ `children` | `array` | ❌ | — | — | |
3095
+ | Name | Type | Required | Default | Possible Values | Description |
3096
+ | -------------------- | -------- | -------- | ------- | --------------- | --------------------------------------------------------------------------------- |
3097
+ | `options` | `object` | ✅ | — | — | |
3098
+ | ​ ↳ `sourceFiles` | `object` | ✅ | — | — | Exact TypeScript sources keyed by absolute logical path. |
3099
+ | ​ ↳ `entrypointFile` | `string` | ❌ | — | — | Absolute logical path of the entry file in sourceFiles. Defaults to /workflow.ts. |
3087
3100
 
3088
- **Returns:** `Promise<FormItem>`
3101
+ **Returns:** `Promise<WorkflowValidationItem>`
3089
3102
 
3090
- | Name | Type | Required | Possible Values | Description |
3091
- | ----------------------- | --------- | -------- | --------------- | ----------- |
3092
- | `data` | `object` | ✅ | — | |
3093
- | ​ ↳ `id` | `string` | ✅ | — | |
3094
- | ​ ↳ `title` | `string` | ✅ | — | |
3095
- | ​ ↳ `description` | `string` | ❌ | — | |
3096
- | ​ ↳ `hosted_url` | `string` | ✅ | — | |
3097
- | ​ ↳ `submission_count` | `number` | ✅ | — | |
3098
- | ​ ↳ `account_id` | `number` | ✅ | — | |
3099
- | ​ ↳ `owner_id` | `string` | ✅ | — | |
3100
- | ​ ↳ `created_at` | `string` | ✅ | — | |
3101
- | ​ ↳ `updated_at` | `string` | ✅ | — | |
3102
- | ​ ↳ `document` | `unknown` | ✅ | — | |
3103
- | ​ ↳ `last_published_at` | `string` | ✅ | — | |
3104
- | ​ ↳ `consumer_auth` | `unknown` | ✅ | — | |
3105
- | ​ ↳ `callback_url` | `unknown` | ✅ | — | |
3103
+ | Name | Type | Required | Possible Values | Description |
3104
+ | ---------------------- | ---------- | -------- | ---------------------------------- | ----------------------------------------------------------------------------------- |
3105
+ | `data` | `object` | ✅ | — | |
3106
+ | ​ ↳ `issues[]` | `object[]` | ✅ | — | Source diagnostics, or an empty array when validation passes. |
3107
+ | ​   ↳ `kind` | `string` | ✅ | — | Extensible diagnostic category; clients must accept unfamiliar values. |
3108
+ | ​   ↳ `message` | `string` | ✅ | — | Safe human-readable explanation. |
3109
+ | ​   ↳ `severity` | `string` | ✅ | `error`, `warning`, `info`, `hint` | Diagnostic severity. |
3110
+ | ​   ↳ `suggestion` | `string` | ❌ | — | Actionable fix hint. |
3111
+ | ​   ↳ `source` | `object` | ❌ | — | Affected source location. |
3112
+ | ​     ↳ `file_id` | `string` | ✅ | — | Source file containing the diagnostic. |
3113
+ | ​     ↳ `start_line` | `number` | ✅ | — | Inclusive 1-based start line. |
3114
+ | ​     ↳ `start_column` | `number` | ✅ | — | Inclusive 1-based start column. |
3115
+ | ​     ↳ `end_line` | `number` | ✅ | — | Inclusive 1-based end line. |
3116
+ | ​     ↳ `end_column` | `number` | ✅ | — | Inclusive 1-based end column. |
3117
+ | ​   ↳ `source_excerpt` | `string` | ❌ | — | Source text the diagnostic was raised against, truncated to 240 characters. |
3118
+ | ​   ↳ `syntax_kind` | `string` | ❌ | — | TypeScript AST node kind the diagnostic was raised against (e.g. `CallExpression`). |
3106
3119
 
3107
3120
  **Example:**
3108
3121
 
3109
3122
  ```typescript
3110
- const { data: form } = await zapier.createForm({
3111
- title: "example-title",
3123
+ const { data: workflowValidation } = await zapier.validateWorkflow({
3124
+ sourceFiles: {
3125
+ "/workflow.ts":
3126
+ 'import { defineDurable } from "@zapier/zapier-durable"; export default defineDurable("hello-world", async (ctx, input) => { return ctx.step("greet", async () => "Hello, world!"); });',
3127
+ },
3112
3128
  });
3113
3129
  ```
3114
3130
 
3115
3131
  ### Tables
3116
3132
 
3133
+ Tables is Zapier's database tool for storing and managing data. Use these to manage tables, their fields, and their records.
3134
+
3117
3135
  #### `createTable`
3118
3136
 
3119
3137
  Create a new table
@@ -3575,6 +3593,8 @@ const { data: records } = await zapier.updateTableRecords({
3575
3593
 
3576
3594
  ### Triggers
3577
3595
 
3596
+ A trigger is an event in an app that starts your automation, like a new email received. Use these to find an app's triggers and receive their events directly in your code, outside a Zap.
3597
+
3578
3598
  #### `ackTriggerInboxMessages`
3579
3599
 
3580
3600
  Acknowledge messages from a lease. Acked messages are removed from the inbox; unacked ones return to the available pool when the lease expires.
@@ -4377,6 +4397,8 @@ await zapier.watchTriggerInbox({
4377
4397
 
4378
4398
  ### Virtual File System (Experimental)
4379
4399
 
4400
+ The Virtual File System is file storage hosted by Zapier. Use these to read, write, and organize files and folders.
4401
+
4380
4402
  > ℹ️ **Experimental.** Still being designed; may change shape or disappear in any release, without notice. Import from `"@zapier/zapier-sdk/experimental"` to use these methods.
4381
4403
 
4382
4404
  #### `appendVfsFile` 🧪 _experimental_