The Zapier SDK lets you call any Zapier app action directly from a JavaScript Code by Zapier step using your existing Zapier connections. You do not need to build a private app or hard-code API keys. The SDK uses your connected accounts and Zapier handles authentication automatically. Credentials are never exposed in your code, Zap history, or logs.
Use the SDK to orchestrate multiple apps, make authenticated API calls, and run multi-step workflows in a single Code step.
Available on plans:
Free
Pro
Team
Enterprise
This feature is rolling out to accounts in phases. If you do not have access yet, it will be available soon.
Prerequisites
- A Zapier account on any plan.
- At least one app connection in your Zapier account.
- Familiarity with JavaScript.
-
Node.js installed on your computer so you can run
npxcommands in a terminal. - The Zapier SDK CLI available via
npxto look up app keys, actions, and input fields. Follow the quickstart guide to log in the first time.
Add the SDK to a Code step
1. Add a JavaScript Code step
- In the Zap editor, click the + icon to add a new step.
- Search for and select Code.
- Click the Action event dropdown menu and select Run JavaScript.
- Click Continue.
2. Enable SDK
In the Configure tab:
- Click Open in Code Editor.
- Click the Packages icon on the left sidebar.
- Click the @zapier/zapier-sdk (latest) toggle switch on.
Zapier automatically imports the package code at the top of the code file.
3. Select your app connections
App connections let you securely call apps from your Code step.
- Click Add app connection.
- Click + Add connection.
- Search for and select the app you want to use.
- Click the Select account connection dropdown menu and select an existing account. - If you need to connect a new account, click + Connect a new account and follow the prompts to connect your app account to Zapier.
-
Once an account is selected, the Account ID Variable field automatically populates with a readable key based on the account label (for example,
slackorgoogle_sheets). This is the identifier you use in your code to reference this connection withconnections[""].- (Optional) Click the Account ID Variable field and type a custom key. This can be any name that helps you identify the connection in your code, for example
slack_personalorsheets_reporting. Each key must be unique within the step. If you reuse a key, an error appears. - (Optional) Click Reset to revert the field to the auto-generated key.
- (Optional) Click the Account ID Variable field and type a custom key. This can be any name that helps you identify the connection in your code, for example
- Click Save.
Repeat this process if you have multiple app connections to add.
Only the Zap owner can add connections to an SDK step. Collaborators who do not have access to the selected connections cannot edit the step.
4. Write your code
When you enable the SDK, Zapier automatically adds the import and initialization code to your Code step. Write your code inside the main function.
The SDK provides three main capabilities:
-
Run actions — Call any Zapier app action using
zapier.apps...(). Each app supports three action types:-
.read— List or retrieve data (for example, list Slack channels). -
.write— Create or update data (for example, send a Slack message). -
.search— Find specific records (for example, look up a user by email).
-
-
Make authenticated HTTP requests — Use
zapier.fetch()to call any API through Zapier's infrastructure. Zapier injects your connection's credentials automatically. -
Find connections — Use
zapier.findFirstConnection()orzapier.listConnections()to look up available app connections by app key.
To find the app key, action key, and input fields for your code, use the Zapier SDK CLI in your local terminal. Log in once per machine, then run the commands below:
-
Log in to the CLI (if you have not already):
bash npx @zapier/zapier-sdk-cli login -
Find the app key — List your connections to get the app key for each connected app:
bash npx @zapier/zapier-sdk-cli list-connections --owner me -
Find available actions — List all actions for an app to get the action keys and types (
read,write,search):bash npx @zapier/zapier-sdk-cli list-actions -
Find input fields — Get the required and optional inputs for a specific action:
bash npx @zapier/zapier-sdk-cli list-input-fields --connection-id
For example, to find the inputs for sending a Slack direct message:
npx @zapier/zapier-sdk-cli list-actions slack
npx @zapier/zapier-sdk-cli list-input-fields slack write direct_message --connection-id YOUR_CONNECTION_ID
Replace YOUR_CONNECTION_ID with the ID returned by list-connections. Some actions have dynamic fields that depend on your account, so the CLI needs a connection to query the app.
import { createZapierSdk } from '@zapier/zapier-sdk';
const zapier = createZapierSdk();
export default async function main({inputData}) {
const { data: slackConn } = await zapier.findFirstConnection({
appKey: "slack",
owner: "me",
isExpired: false,
});
const slack = zapier.apps.slack({
connectionId: slackConn.id,
});
const { data: result } = await slack.write.direct_message({
inputs: {
channel: "YOUR_SLACK_USERNAME",
text: "Hello from the Zapier SDK!",
},
});
return { result };
}
This example creates a Jira ticket, posts a summary to Slack, and logs a row in Google Sheets, all from a single Code step:
import { createZapierSdk } from '@zapier/zapier-sdk';
const zapier = createZapierSdk();
export default async function main({inputData}) {
const { data: jiraConn } = await zapier.findFirstConnection({
appKey: "jira-software-cloud",
owner: "me",
});
const { data: slackConn } = await zapier.findFirstConnection({
appKey: "slack",
owner: "me",
});
const { data: sheetsConn } = await zapier.findFirstConnection({
appKey: "google-sheets",
owner: "me",
});
const jira = zapier.apps.jira_software_cloud({
connectionId: jiraConn.id,
});
const slack = zapier.apps.slack({ connectionId: slackConn.id });
const sheets = zapier.apps.google_sheets({
connectionId: sheetsConn.id,
});
const { data: ticket } = await jira.write.create_issue({
inputs: {
project: "PROJECT_KEY",
issuetype: "Task",
summary: inputData.summary,
},
});
await slack.write.channel_message({
inputs: {
channel: "CHANNEL_ID",
text: `New ticket: ${ticket.key} - ${inputData.summary}`,
},
});
await sheets.write.create_spreadsheet_row({
inputs: {
spreadsheet: "SPREADSHEET_ID",
worksheet: "Sheet1",
ticket_key: ticket.key,
summary: inputData.summary,
created: new Date().toISOString(),
},
});
return { ticket_key: ticket.key };
}
For complete SDK documentation including all available methods and the CLI reference, review the Zapier SDK documentation.
5. Test your Code step
- Click Run Code to test your code.
- Review the Output Data panel for results.
If the step is successful, it displays the data returned by your SDK calls. Errors from SDK actions appear in the output and in your Zap history.
Limitations
- The SDK is available in JavaScript Code steps only. Python is not supported.
- Code steps are subject to your plan's runtime limits. Free plans allow 1-second per-step runtime with a 2-minute monthly cap. Paid plans support longer runtimes up to 10 minutes.
- Expired or invalid connections produce runtime errors. Re-authenticate the connection in the Zap editor if this occurs.
- Only the Zap owner can add connections to an SDK step. Collaborators who do not have access to the selected connections cannot edit the step.