Skip to main content
This page documents all available methods in the Zapier SDK.

Installation

npm install @zapier/zapier-sdk
npm install -D @zapier/zapier-sdk-cli @types/node typescript

Initialization

import { createZapierSdk } from "@zapier/zapier-sdk";

// Option 1: Browser-based auth (run `npx zapier-sdk login` first)
const zapier = createZapierSdk();

// Option 2: Direct token
const zapier = createZapierSdk({
  credentials: "your_zapier_token_here",
});

// Option 3: Client credentials
const zapier = createZapierSdk({
  credentials: {
    clientId: "your_client_id",
    clientSecret: "your_client_secret",
  },
});

Accounts

getProfile

Get the current user’s profile information.
const { data: profile } = await zapier.getProfile();
Returns: Promise<ProfileItem>

Apps

listApps

List all available apps with optional filtering.
// Get first page
const { data: apps, nextCursor } = await zapier.listApps();

// With search filter
const { data: apps } = await zapier.listApps({ search: "slack" });

// Iterate over all pages
for await (const page of zapier.listApps()) {
  console.log(page.data);
}

// Iterate over all items
for await (const app of zapier.listApps({ maxItems: 100 }).items()) {
  console.log(app.title);
}
Parameters:
NameTypeRequiredDescription
appKeysarrayNoFilter by specific app keys
searchstringNoSearch term to filter apps by name
pageSizenumberNoNumber of apps per page
maxItemsnumberNoMaximum total items to return across all pages
cursorstringNoCursor for pagination
Returns: Promise<PaginatedResult<AppItem>>

getApp

Get detailed information about a specific app.
const { data: app } = await zapier.getApp({ appKey: "slack" });
Parameters:
NameTypeRequiredDescription
appKeystringYesApp key (e.g., slack, github)
Returns: Promise<AppItem>

Actions

listActions

List all actions for a specific app.
const { data: actions } = await zapier.listActions({ appKey: "slack" });

// Filter by action type
const { data: writeActions } = await zapier.listActions({
  appKey: "slack",
  actionType: "write",
});
Parameters:
NameTypeRequiredDescription
appKeystringYesApp key to list actions for
actionTypestringNoFilter by type: read, write, search, run, filter, search_or_write, read_bulk
pageSizenumberNoNumber of actions per page
maxItemsnumberNoMaximum total items to return
cursorstringNoCursor for pagination
Returns: Promise<PaginatedResult<ActionItem>>

getAction

Get detailed information about a specific action.
const { data: action } = await zapier.getAction({
  appKey: "slack",
  actionType: "write",
  actionKey: "send_channel_message",
});
Parameters:
NameTypeRequiredDescription
appKeystringYesApp key
actionTypestringYesAction type
actionKeystringYesSpecific action key
Returns: Promise<ActionItem>

runAction

Execute an action with the given inputs.
const { data: result } = await zapier.runAction({
  appKey: "slack",
  actionType: "write",
  actionKey: "send_channel_message",
  authenticationId: "auth_123",
  inputs: {
    channel: "#general",
    text: "Hello from the SDK!",
  },
});
Parameters:
NameTypeRequiredDescription
appKeystringYesApp key
actionTypestringYesAction type
actionKeystringYesAction key
authenticationIdstring, numberNoAuthentication ID to use
inputsobjectNoInput parameters for the action
pageSizenumberNoNumber of results per page
maxItemsnumberNoMaximum total items to return
cursorstringNoCursor for pagination
Returns: Promise<PaginatedResult<ActionResultItem>>

listInputFields

Get the input fields required for a specific action.
const { data: fields } = await zapier.listInputFields({
  appKey: "slack",
  actionType: "write",
  actionKey: "send_channel_message",
  authenticationId: "auth_123",
});
Parameters:
NameTypeRequiredDescription
appKeystringYesApp key
actionTypestringYesAction type
actionKeystringYesAction key
authenticationIdstring, numberNoAuthentication ID (required for some fields)
inputsobjectNoCurrent inputs that may affect available fields
Returns: Promise<PaginatedResult<RootFieldItem>>

listInputFieldChoices

Get available choices for a dynamic dropdown field.
const { data: choices } = await zapier.listInputFieldChoices({
  appKey: "slack",
  actionType: "write",
  actionKey: "send_channel_message",
  inputFieldKey: "channel",
  authenticationId: "auth_123",
});
Parameters:
NameTypeRequiredDescription
appKeystringYesApp key
actionTypestringYesAction type
actionKeystringYesAction key
inputFieldKeystringYesField to get choices for
authenticationIdstring, numberNoAuthentication ID
inputsobjectNoCurrent inputs
Returns: Promise<PaginatedResult<InputFieldChoiceItem>>

getInputFieldsSchema

Get the JSON Schema for an action’s input fields.
const { data: schema } = await zapier.getInputFieldsSchema({
  appKey: "slack",
  actionType: "write",
  actionKey: "send_channel_message",
});
Returns: Promise<InputSchemaItem>

App Proxy Pattern

The SDK provides a convenient proxy pattern for accessing apps and actions.

apps.{appKey}

Bind an authentication to an app for cleaner syntax.
// Create a bound app instance
const slack = zapier.apps.slack({
  authenticationId: "auth_123",
});

// Now run actions without specifying auth each time
const { data: channels } = await slack.read.channels({});
const { data: result } = await slack.write.send_channel_message({
  inputs: { channel: "#general", text: "Hello!" },
});

apps.{appKey}.{actionType}.{actionKey}

Run an action directly with inline authentication.
// Without binding - pass auth inline
const { data: channels } = await zapier.apps.slack.read.channels({
  authenticationId: "auth_123",
});

// For apps with dashes, use snake_case or bracket notation
const { data: rows } = await zapier.apps.google_sheets.read.rows({
  authenticationId: "auth_456",
});
// Or: zapier.apps["google-sheets"].read.rows(...)

Authentications

listAuthentications

List available authentications with optional filtering.
// List all your Slack authentications
const { data: auths } = await zapier.listAuthentications({
  appKey: "slack",
  owner: "me",
});
Parameters:
NameTypeRequiredDescription
appKeystringNoFilter by app key
authenticationIdsarrayNoFilter by specific IDs
searchstringNoSearch by title
titlestringNoFilter by exact title match
accountIdstringNoFilter by account ID
ownerstringNoFilter by owner (me or specific user ID)
isExpiredbooleanNoFilter by expiration status
Returns: Promise<PaginatedResult<AuthenticationItem>>

getAuthentication

Get a specific authentication by ID.
const { data: auth } = await zapier.getAuthentication({
  authenticationId: "auth_123",
});
Returns: Promise<AuthenticationItem>

findFirstAuthentication

Find the first authentication matching criteria.
const { data: auth } = await zapier.findFirstAuthentication({
  appKey: "slack",
  owner: "me",
});
Returns: Promise<AuthenticationItem>

findUniqueAuthentication

Find exactly one authentication matching criteria (throws if multiple found).
const { data: auth } = await zapier.findUniqueAuthentication({
  appKey: "slack",
  title: "My Workspace",
});
Returns: Promise<AuthenticationItem>

Client Credentials

listClientCredentials

List client credentials for the authenticated user.
const { data: credentials } = await zapier.listClientCredentials();
Returns: Promise<PaginatedResult<ClientCredentialsItem>>

createClientCredentials

Create new client credentials.
const result = await zapier.createClientCredentials({
  name: "My Server App",
  allowed_scopes: ["external"],
});
Parameters:
NameTypeRequiredDefaultDescription
namestringYesName for the credentials
allowed_scopesarrayNo["external"]Scopes to allow

deleteClientCredentials

Delete client credentials by client ID.
await zapier.deleteClientCredentials({
  clientId: "client_123",
});

HTTP Requests

request

Make authenticated HTTP requests through Zapier’s relay service.
const response = await zapier.request({
  url: "https://slack.com/api/users.list",
  method: "GET",
  authenticationId: "auth_123",
});

const data = await response.json();
Parameters:
NameTypeRequiredDescription
urlstringYesURL to request
methodstringNoHTTP method (GET, POST, etc.)
bodystringNoRequest body
headersobjectNoRequest headers
authenticationIdstringNoAuthentication ID to use
callbackUrlstringNoURL for async response
authenticationTemplatestringNoCustom auth template
Returns: Promise<Response>

fetch

A fetch-compatible interface for making requests.
const response = await zapier.fetch("https://api.example.com/data", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ key: "value" }),
  authenticationId: "auth_123",
});
Returns: Promise<Response>

CLI Commands

The SDK includes a CLI for common tasks:
# Authenticate via browser
npx zapier-sdk login

# Generate TypeScript types for apps
npx zapier-sdk add slack google-sheets

# Search for apps
npx zapier-sdk list-apps --search "google"

# Custom output directory for types
npx zapier-sdk add slack --types-output ./types