Installation
Initialization
Option 1: CLI Authentication Runningnpx zapier-sdk signup or npx zapier-sdk login authenticates through the CLI. As long as you have the CLI package installed as a development dependency, the SDK will automatically use that authentication.
npx zapier-sdk create-client-credentials. This allows you to run the SDK in a server/serverless environment.
Accounts
getProfile
Get current user’s profile information
Parameters:
Returns:
Promise<ProfileItem>
Example:
Actions
getAction
Get detailed information about a specific action
Parameters:
Returns:
Promise<ActionItem>
Example:
getActionInputFieldsSchema
Get the JSON Schema representation of input fields for an action. Returns a JSON Schema object describing the structure, types, and validation rules for the action’s input parameters.
Parameters:
Returns:
Promise<InputSchemaItem>
Example:
listActionInputFieldChoices
Get the available choices for a dynamic dropdown input field
Parameters:
Returns:
Promise<PaginatedResult<InputFieldChoiceItem>>
Example:
listActionInputFields
Get the input fields required for a specific action
Parameters:
Returns:
Promise<PaginatedResult<RootFieldItem>>
When
type is "input_field":
When
type is "info_field":
When
type is "fieldset":
Example:
listActions
List all actions for a specific app
Parameters:
Returns:
Promise<PaginatedResult<ActionItem>>
Example:
runAction
Execute an action with the given inputs
Parameters:
Returns:
Promise<PaginatedResult<ActionResultItem>>
Example:
Apps
apps.{appKey}
Bind a connection alias or numeric connectionId to an app
Parameters:
Returns:
Promise<AppProxy>
Example:
apps.{appKey}.{actionType}.{actionKey}
Execute an action with the given inputs for the bound app, as an alternative to runAction
Parameters:
Returns:
Promise<PaginatedResult<ActionResultItem>>
Example:
getApp
Get detailed information about a specific app
Parameters:
Returns:
Promise<AppItem>
Example:
listApps
List all available apps with optional filtering
Parameters:
Returns:
Promise<PaginatedResult<AppItem>>
Example:
Client Credentials
createClientCredentials
Create new client credentials for the authenticated user
Parameters:
Returns:
Promise<ClientCredentialsItem>
Example:
deleteClientCredentials
Delete client credentials by client ID
Parameters:
Returns:
Promise<{ success: boolean }>
Example:
listClientCredentials
List client credentials for the authenticated user
Parameters:
Returns:
Promise<PaginatedResult<ClientCredentialsItem>>
Example:
Connections
createConnection
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.
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.
Parameters:
Returns:
Promise<ConnectionItem>
Example:
findFirstConnection
Find the first connection matching the criteria
Parameters:
Returns:
Promise<ConnectionItem>
Example:
findUniqueConnection
Find a unique connection matching the criteria
Parameters:
Returns:
Promise<ConnectionItem>
Example:
getConnection
Get details for a specific connection
Parameters:
Returns:
Promise<ConnectionItem>
Example:
getConnectionStartUrl
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.
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.
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):
Returns:
Promise<ConnectionStartUrlItem>
Example:
listConnections
List available connections with optional filtering
Parameters:
Returns:
Promise<PaginatedResult<ConnectionItem>>
Example:
waitForNewConnection
Wait for a new connection to appear for the given app. Polls /api/v0/connections with server-side ordering=-date 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):
Returns:
Promise<ConnectionItem>
Example:
HTTP Requests
fetch
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.
Parameters:
Returns:
Promise<Response>
Example:
Tables
createTable
Create a new table
Parameters:
Returns:
Promise<TableItem>
Example:
createTableFields
Create one or more fields in a table
Parameters:
Returns:
Promise<FieldItem[]>
Example:
createTableRecords
Create one or more records in a table
Parameters:
Returns:
Promise<RecordItem[]>
Example:
deleteTable
Delete a table by its ID
Parameters:
Returns:
Promise<{ success: boolean }>
Example:
deleteTableFields
Delete one or more fields from a table
Parameters:
Returns:
Promise<{ success: boolean }>
Example:
deleteTableRecords
Delete one or more records from a table
Parameters:
Returns:
Promise<{ success: boolean }>
Example:
getTable
Get detailed information about a specific table
Parameters:
Returns:
Promise<TableItem>
Example:
getTableRecord
Get a single record from a table by ID
Parameters:
Returns:
Promise<RecordItem>
Example:
listTableFields
List fields for a table
Parameters:
Returns:
Promise<PaginatedResult<FieldItem>>
Example:
listTableRecords
List records in a table with optional filtering and sorting
Parameters:
Returns:
Promise<PaginatedResult<RecordItem>>
Example:
listTables
List tables available to the authenticated user
Parameters:
Returns:
Promise<PaginatedResult<TableItem>>
Example:
updateTableRecords
Update one or more records in a table
Parameters:
Returns:
Promise<RecordItem[]>
Example:
Triggers
ackTriggerInboxMessages
Acknowledge messages from a lease. Acked messages are removed from the inbox; unacked ones return to the available pool when the lease expires.
Parameters:
Returns:
Promise<TriggerInboxAckItem>
Example:
createTriggerInbox
Create a new trigger inbox subscription. Always creates a new inbox; use ensureTriggerInbox for get-or-create on a stable key.
Parameters:
Returns:
Promise<TriggerInboxItem>
Example:
deleteTriggerInbox
Mark a trigger inbox for deletion
Parameters:
Returns:
Promise<{ success: boolean }>
Example:
drainTriggerInbox
Drain an existing trigger inbox: lease currently-available messages, process each via onMessage, return when the inbox is empty, maxMessages is reached, or the abort signal fires.
Parameters:
Returns:
Promise<void>
Example:
ensureTriggerInbox
Get-or-create a trigger inbox by key. Idempotent on (user, account, key): returns the existing inbox if a matching subscription is registered, creates a new one otherwise. Throws ZapierConflictError if the key exists with a different subscription.
Parameters:
Returns:
Promise<TriggerInboxItem>
Example:
getTriggerInbox
Get details of a trigger inbox by ID
Parameters:
Returns:
Promise<TriggerInboxItem>
Example:
getTriggerInputFieldsSchema
Get the JSON Schema representation of input fields for a trigger. Returns a JSON Schema object describing the structure, types, and validation rules for the trigger’s input parameters.
Parameters:
Returns:
Promise<any>
Example:
leaseTriggerInboxMessages
Lease up to N messages from a trigger inbox. Returns messages plus a lease ID; ack within the lease window to remove from the inbox.
Parameters:
Returns:
Promise<TriggerInboxLeaseItem>
Example:
listTriggerInboxMessages
List messages in a trigger inbox (no payload, status-only)
Parameters:
Returns:
Promise<PaginatedResult<TriggerMessageItem>>
Example:
listTriggerInboxes
List all trigger inboxes for the authenticated user
Parameters:
Returns:
Promise<PaginatedResult<TriggerInboxItem>>
Example:
listTriggerInputFieldChoices
Get the available choices for a dynamic dropdown input field on a trigger
Parameters:
Returns:
Promise<PaginatedResult<InputFieldChoiceItem>>
Example:
listTriggerInputFields
Get the input fields required for a specific trigger
Parameters:
Returns:
Promise<PaginatedResult<RootFieldItem>>
When
type is "input_field":
When
type is "info_field":
When
type is "fieldset":
Example:
listTriggers
List all triggers for a specific app
Parameters:
Returns:
Promise<PaginatedResult<ActionItem>>
Example:
pauseTriggerInbox
Pause a trigger inbox; events stop being collected
Parameters:
Returns:
Promise<TriggerInboxItem>
Example:
releaseTriggerInboxMessages
Release messages from a lease back to the inbox without acknowledging them. Released messages become immediately available for re-leasing. The lease attempt still counts against the per-message lease limit; releasing does not refund the attempt.
Parameters:
Returns:
Promise<TriggerInboxReleaseItem>
Example:
resumeTriggerInbox
Resume a paused trigger inbox; events resume being collected
Parameters:
Returns:
Promise<TriggerInboxItem>
Example:
updateTriggerInbox
Update settings on an existing trigger inbox
Parameters:
Returns:
Promise<TriggerInboxItem>
Example:
watchTriggerInbox
Continuously consume a trigger inbox: drain currently-available messages via onMessage, then subscribe to SSE notifications for new arrivals until aborted. A periodic safety drain runs every maxDrainIntervalSeconds (default: 300) to guarantee forward progress if SSE events are missed. Resolves cleanly on signal abort or ZapierAbortDrainSignal from a handler. Transient drain failures (5xx, 429, network blips) retry indefinitely with bounded backoff until they succeed or the watch is aborted; it rejects on a fail-fast handler error, an initialization_failure, or a permanent HTTP error. Real-time wake-up health is reported on stderr: a warning when wake-ups pause and the watch falls back to the safety drain, plus (with debug) transient reconnect notices. Persistent drain failures likewise warn once on stderr while bounded-backoff retries continue.
Parameters:
Returns:
Promise<void>
Example:
Code Workflows (Experimental)
ℹ️ Experimental. Import from "@zapier/zapier-sdk/experimental" to use these methods. Methods and behavior may change.
cancelDurableRun
Cancel a run-once durable run in initialized or started status. Returns 409 if the run is already terminal.
Parameters:
Returns:
Promise<DurableRunItem>
Example:
createWorkflow
Create a durable workflow container. Starts disabled with no version; publish a version to add code.
Parameters:
Returns:
Promise<WorkflowItem>
Example:
deleteWorkflow
Delete a durable workflow. Throws ZapierNotFoundError if the workflow doesn’t exist; callers wanting idempotency should catch that themselves.
Parameters:
Returns:
Promise<{ success: boolean }>
Example:
disableWorkflow
Disable a durable workflow so it stops accepting triggers
Parameters:
Returns:
Promise<WorkflowItem>
Example:
enableWorkflow
Enable a durable workflow so it accepts triggers
Parameters:
Returns:
Promise<WorkflowItem>
Example:
getDurableRun
Get the full state of a run-once durable run, including its operations journal
Parameters:
Returns:
Promise<DurableRunItem>
Example:
getTriggerRun
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.
Parameters:
Returns:
Promise<WorkflowRunItem>
Example:
getWorkflow
Get a durable workflow with its current version details and trigger claim status
Parameters:
Returns:
Promise<WorkflowItem>
Example:
getWorkflowRun
Get the current state of a workflow run (a triggered execution of a deployed workflow)
Parameters:
Returns:
Promise<WorkflowRunItem>
Example:
getWorkflowVersion
Get full details of a workflow version including source files
Parameters:
Returns:
Promise<WorkflowVersionItem>
Example:
listDurableRuns
List run-once durable runs for the authenticated account, newest first
Parameters:
Returns:
Promise<PaginatedResult<DurableRunItem>>
Example:
listWorkflowRuns
List workflow runs (triggered executions) for a specific deployed workflow, newest first
Parameters:
Returns:
Promise<PaginatedResult<WorkflowRunItem>>
Example:
listWorkflowVersions
List published versions for a workflow, newest first
Parameters:
Returns:
Promise<PaginatedResult<WorkflowVersionItem>>
Example:
listWorkflows
List all active durable workflows for the authenticated account
Parameters:
Returns:
Promise<PaginatedResult<WorkflowItem>>
Example:
publishWorkflowVersion
Publish a new version of a durable workflow. Enables the workflow by default.
Parameters:
Returns:
Promise<WorkflowVersionItem>
Example:
runDurable
Run a workflow source file as a run-once durable run on code-substrate-runner (no deployed workflow required). Returns the run ID immediately; poll via getDurableRun for terminal status.
Parameters:
Returns:
Promise<DurableRunItem>
Example:
triggerWorkflow
Look up a workflow’s trigger URL and fire it manually, as the authenticated account.
Parameters:
Returns:
Promise<WorkflowRunItem>
Example:
updateWorkflow
Update a durable workflow’s name and/or description
Parameters:
Returns:
Promise<WorkflowItem>
Example: