πŸš€ Big News:Socket Has Acquired Secure Annex.Learn More β†’
Socket
Book a DemoSign in
Socket

@zapier/zapier-sdk

Package Overview
Dependencies
Maintainers
1
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zapier/zapier-sdk

Complete Zapier SDK - combines all Zapier SDK packages

latest
Source
npmnpm
Version
0.45.1
Version published
Weekly downloads
11K
34.38%
Maintainers
1
Weekly downloads
Β 
Created
Source

@zapier/zapier-sdk

Table of Contents

Documentation

The official documentation is available at:

https://docs.zapier.com/sdk

Agents are sometimes blocked from viewing docs on npm, so you may want to provide them a link to the official docs or copy the docs here into a prompt.

Quick Start

For new projects.

The following will create a new project from scratch, set up the SDK and the SDK CLI, and give you a working starter example to get you going:

# Create a new Zapier SDK project (scaffolds files, installs deps, and logs you in).
npx @zapier/zapier-sdk-cli init my-zapier-app

# Or skip the interactive prompts and accept all defaults.
npx @zapier/zapier-sdk-cli init my-zapier-app --skip-prompts

Installation

For existing projects.

If you already have a project and want to start integrating apps through Zapier using the SDK:

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

Walkthrough

Assuming you've installed the CLI package into your project (see instructions above), you (or an agent) can start using it right away. This is useful for introspecting actions, connections, etc. that you want to use in code, but you can also use it to directly use integrations.

# See all available commands
npx zapier-sdk --help

# Login to Zapier.
npx zapier-sdk login

# Search from thousands of supported apps.
npx zapier-sdk list-apps --search "gmail"
# The output will show you the valid keys next to the app title like this:
# 1. Gmail (GoogleMailV2CLIAPI, gmail)

# Run any action for the app, using one of the app keys.
npx zapier-sdk run-action gmail
# This will ask you for the type of action you want to run.
# `search` or `write` are typically great for testing.
# Note that you usually need a connection to the app to run
# the action. If you don't already have one, you can create a new one at:
# https://zapier.com/app/assets/connections

# List connections for an app.
npx zapier-sdk list-connections gmail
# Or only list the ones you own.
npx zapier-sdk list-connections gmail --owner me
# Or just grab the first one.
npx zapier-sdk find-first-connection gmail --owner me

# Make any API request to an app using your connection.
npx zapier-sdk fetch "https://gmail.googleapis.com/gmail/v1/users/me/labels" --connection-id 123

The following is optional, but if you want to call our actions from code, it can be helpful to install TypeScript types for those actions. You can also just use fetch to make arbitrary API requests. In that case, you don't really need this, and instead you might need types or a good agent that will look up third party API docs.

# Search for apps that you want to use.
npx zapier-sdk list-apps --search "slack"
npx zapier-sdk list-apps --search "google sheets"
# The output will show you the valid keys next to the app title like this:
# 1. Slack (SlackCLIAPI, slack)
# 1. Google Sheets (GoogleSheetsV2CLIAPI, google-sheets, google_sheets)

# Generate TypeScript types for actions and fields of any apps you want to use.
npx zapier-sdk add slack google-sheets

# By default, types will be generated inside your `src` or `lib` folder if you
# have one or otherwise the root folder. Make sure your `tsconfig.json` file
# includes the generated type files.

# Alternatively, you can specify a custom output directory.
npx zapier-sdk add slack google-sheets --types-output ./types

Now let's write some code!

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

// ######## Initialize Zapier SDK ########
// Option 1: Running `zapier-sdk login` authenticates through your browser and
// stores a token on your local machine. As long as you have the CLI package
// installed as a development dependency, the SDK will automatically use it.
const zapier = createZapierSdk();

// Option 2: Provide a client ID and client secret.
// You can get these by running `zapier-sdk create-client-credentials`.
// This allows you to run the SDK in a server/serverless environment.
// const zapier = createZapierSdk({
//   credentials: {
//     clientId: "your_client_id_here", // or use ZAPIER_CREDENTIALS_CLIENT_ID env var
//     clientSecret: "your_client_secret_here", // or use ZAPIER_CREDENTIALS_CLIENT_SECRET env var
//   },
// });

// Option 3: Provide a valid Zapier token.
// This is for partner OAuth or internal Zapier use.
// const zapier = createZapierSdk({
//   credentials: "your_zapier_token_here", // or use ZAPIER_CREDENTIALS env var
// });

// ######## Access Apps ########
// List methods return a promise for a page with {data, nextCursor}.
const { data: firstPageApps, nextCursor } = await zapier.listApps();
// Use the cursor to get the next page:
const { data: secondPageApps } = await zapier.listApps({ cursor: nextCursor });

console.log({
  firstPageApps,
  secondPageApps,
});

// List methods also return an iterable for all pages.
// Be careful with lots of pages, note the `search` to filter.
for await (const page of zapier.listApps({ search: "slack" })) {
  const { data: apps } = page;
  console.log({
    apps,
  });
}

// Use `.items()` to iterate over all items of all pages:
// Again, be careful with lots of items. Note the `maxItems` to limit the total items.
for await (const app of zapier.listApps({ maxItems: 100 }).items()) {
  console.log({
    app,
  });
}

// You can collect all results, but this could take a while for long lists!
const allApps = await Array.fromAsync(
  zapier.listApps({ maxItems: 100 }).items(),
);

console.log({
  allApps,
});

// The item methods return a promise for a single item, wrapped with {data}.
// This is just to give us room to add metadata in the future.
const { data: app } = await zapier.getApp({ app: "slack" });

console.log({
  app,
});

// ######## Connection Usage ########
const { data: myConnections } = await zapier.listConnections({
  app: "slack",
  owner: "me",
});

console.log({
  myConnections,
});

// ######## Find Actions ########
// Option 1: List actions
// Remember, this is just the first page which may not include them all!
// See `.items()` usage above, which can be used to make sure you get all actions.
const { data: actions } = await zapier.listActions({ app: "slack" });

console.log({
  actions,
});

const singleAction = await zapier.getAction({
  app: "slack",
  actionType: actions[0].action_type,
  action: actions[0].key,
});

console.log({
  singleAction,
});

// Option 2: Access actions via the `apps` proxy
// If you've generated TS types for an app using `zapier-sdk add`, you can
// access the app's actions like this:

// await zapier.apps.slack.read.channles({});
// await zapier.apps.slack.write.send_message({})

// ######## Run Actions ########
// Option 1:
const { data: channels } = await zapier.runAction({
  app: "slack",
  actionType: "read",
  action: "channels",
  connection: myConnections[0].id,
});

console.log({
  channels,
});

const { data: profile } = await zapier.getProfile();

// Option 2:
// Create an app binding to your connection.
const mySlack = zapier.apps.slack({
  connection: myConnections[0].id,
});

// Use your app binding to run the action.
const { data: users } = await mySlack.search.user_by_email({
  inputs: {
    email: profile.email,
  },
});

console.log({
  users,
});

// You can also skip the app binding and pass the connection into the action.
const { data: sameUsers } = await zapier.apps.slack.search.user_by_email({
  inputs: {
    email: profile.email,
  },
  connection: myConnections[0].id,
});

console.log({
  sameUsers,
});

// If the slug for an app has dashes, you can also use a snake_cased app key.
// For example, either of the following are valid:
// zapier.apps["google-sheets"]
// zapier.apps.google_sheets

// We have tens of thousands of actions across thousands of apps, but you're
// still not limited to those. You can make any arbitrary API request to an app
// using the same connections with `.fetch`! This returns a response just
// like a normal `fetch` call in JavaScript.
const emojiResponse = await zapier.fetch("https://slack.com/api/emoji.list", {
  connection: myConnections[0].id,
});

const emojiData = await emojiResponse.json();

console.log(emojiData.emoji);

Factory

The createZapierSdk(...) factory function is the main entry point for the SDK. It provides methods for managing connections, listing apps, running actions, and more.

NameTypeRequiredDefaultPossible ValuesDescription
credentialsstring, object, functionβŒβ€”β€”Authentication credentials. Can be a string (token or API key), a client credentials object ({ clientId, clientSecret }), a PKCE object ({ clientId }), or a function returning any of those.
debugbooleanβŒβ€”β€”Enable debug logging.
baseUrlstringβŒβ€”β€”Base URL for Zapier API endpoints.
trackingBaseUrlstringβŒβ€”β€”Base URL for Zapier tracking endpoints.
maxNetworkRetriesnumberβŒβ€”β€”Max retries for rate-limited requests (default: 3).
maxNetworkRetryDelayMsnumberβŒβ€”β€”Max delay in ms to wait for retry (default: 60000).
canIncludeSharedConnectionsbooleanβŒβ€”β€”Allow listing shared connections.
canIncludeSharedTablesbooleanβŒβ€”β€”Allow listing shared tables.
canDeleteTablesbooleanβŒβ€”β€”Allow deleting tables.

Named Connections

Named connections let you decouple workflow code from specific connection IDs. Instead of hardcoding an ID, you reference a connection by name and the SDK resolves it from a mapping.

This is useful when an execution engine or deployment system manages which connections a workflow should use.

Providing the mapping

Connections are configured in .zapierrc alongside app version pins, or inline via the manifest option:

const zapier = createZapierSdk({
  manifest: {
    apps: { slack: { implementationName: "SlackCLIAPI", version: "1.21.1" } },
    connections: {
      slack_work: { connectionId: "01234567-89ab-cdef-0123-456789abcdef" },
      google_sheets: { connectionId: 67890 },
    },
  },
});

Each connection entry maps a name to a connectionId. The Zapier connections API returns UUID-format IDs (the id field on entries from listConnections); positive integers from older connections are also accepted. App version resolution is handled separately via the apps section of .zapierrc.

Using named connections

Reference connections using the connection parameter. Pass a connection name to be resolved from the connections map, or a connection ID to be used directly.

// Per-call with alias
await zapier.apps.slack.read.channels({ connection: "slack_work" });

// Factory binding
const slack = zapier.apps.slack({ connection: "slack_work" });
await slack.read.channels({});

// Lower-level runAction
await zapier.runAction({
  app: "slack",
  actionType: "read",
  action: "channels",
  connection: "slack_work",
});

// Authenticated fetch
await zapier.fetch("https://slack.com/api/auth.test", {
  connection: "slack_work",
});

// Direct connection ID also works (UUID or legacy positive integer)
await zapier.apps.slack.read.channels({
  connection: "01234567-89ab-cdef-0123-456789abcdef",
});

Available Functions

Accounts

getProfile

Get current user's profile information

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβŒβ€”β€”

Returns: Promise<ProfileItem>

Example:

const { data: profile } = await zapier.getProfile();

Actions

getAction

Get detailed information about a specific action

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ appstringβœ…β€”β€”App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3')
↳ actionTypestringβœ…β€”read, read_bulk, write, run, search, search_or_write, search_and_write, filterAction type that matches the action's defined type
↳ actionstringβœ…β€”β€”Action key (e.g., 'send_message' or 'find_row')

Returns: Promise<ActionItem>

Example:

const { data: action } = await zapier.getAction({
  app: "example-value",
  actionType: "read",
  action: "example-value",
});

getInputFieldsSchema

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:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ appstringβœ…β€”β€”App key (e.g., 'SlackCLIAPI' or slug like 'github') to get the input schema for
↳ actionTypestringβœ…β€”read, read_bulk, write, run, search, search_or_write, search_and_write, filterAction type that matches the action's defined type
↳ actionstringβœ…β€”β€”Action key to get the input schema for
↳ connectionstring, 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. Mutually exclusive with connectionId.
↳ inputsobjectβŒβ€”β€”Current input values that may affect the schema (e.g., when fields depend on other field values)

Returns: Promise<InputSchemaItem>

Example:

const { data: inputSchema } = await zapier.getInputFieldsSchema({
  app: "example-value",
  actionType: "read",
  action: "example-value",
});

listActions

List all actions for a specific app

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ appstringβœ…β€”β€”App key of actions to list (e.g., 'SlackCLIAPI' or slug like 'github')
↳ actionTypestringβŒβ€”read, read_bulk, write, run, search, search_or_write, search_and_write, filterFilter actions by type
↳ pageSizenumberβŒβ€”β€”Number of actions per page
↳ maxItemsnumberβŒβ€”β€”Maximum total items to return across all pages
↳ cursorstringβŒβ€”β€”Cursor to start from

Returns: Promise<PaginatedResult<ActionItem>>

Example:

// Get first page and a cursor for the second page
const { data: actions, nextCursor } = await zapier.listActions({
  app: "example-value",
});

// Or iterate over all pages
for await (const page of zapier.listActions({
  app: "example-value",
})) {
  // Do something with each page
}

// Or iterate over individual items across all pages
for await (const action of zapier
  .listActions({
    app: "example-value",
  })
  .items()) {
  // Do something with each action
}

listInputFieldChoices

Get the available choices for a dynamic dropdown input field

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ appstringβœ…β€”β€”App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3')
↳ actionTypestringβœ…β€”read, read_bulk, write, run, search, search_or_write, search_and_write, filterAction type that matches the action's defined type
↳ actionstringβœ…β€”β€”Action key (e.g., 'send_message' or 'find_row')
↳ inputFieldstringβœ…β€”β€”Input field key to get choices for
↳ connectionstring, 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. Mutually exclusive with connectionId.
↳ inputsobjectβŒβ€”β€”Current input values that may affect available choices
↳ pagenumberβŒβ€”β€”Page number for paginated results
↳ pageSizenumberβŒβ€”β€”Number of choices per page
↳ maxItemsnumberβŒβ€”β€”Maximum total items to return across all pages
↳ cursorstringβŒβ€”β€”Cursor to start from

Returns: Promise<PaginatedResult<InputFieldChoiceItem>>

Example:

// Get first page and a cursor for the second page
const { data: inputFieldChoices, nextCursor } =
  await zapier.listInputFieldChoices({
    app: "example-value",
    actionType: "read",
    action: "example-value",
    inputField: "example-value",
  });

// Or iterate over all pages
for await (const page of zapier.listInputFieldChoices({
  app: "example-value",
  actionType: "read",
  action: "example-value",
  inputField: "example-value",
})) {
  // Do something with each page
}

// Or iterate over individual items across all pages
for await (const inputFieldChoice of zapier
  .listInputFieldChoices({
    app: "example-value",
    actionType: "read",
    action: "example-value",
    inputField: "example-value",
  })
  .items()) {
  // Do something with each inputFieldChoice
}

listInputFields

Get the input fields required for a specific action

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ appstringβœ…β€”β€”App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3')
↳ actionTypestringβœ…β€”read, read_bulk, write, run, search, search_or_write, search_and_write, filterAction type that matches the action's defined type
↳ actionstringβœ…β€”β€”Action key (e.g., 'send_message' or 'find_row')
↳ connectionstring, 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. Mutually exclusive with connectionId.
↳ inputsobjectβŒβ€”β€”Current input values that may affect available fields
↳ pageSizenumberβŒβ€”β€”Number of input fields per page
↳ maxItemsnumberβŒβ€”β€”Maximum total items to return across all pages
↳ cursorstringβŒβ€”β€”Cursor to start from

Returns: Promise<PaginatedResult<RootFieldItemItem>>

Example:

// Get first page and a cursor for the second page
const { data: rootFieldItems, nextCursor } = await zapier.listInputFields({
  app: "example-value",
  actionType: "read",
  action: "example-value",
});

// Or iterate over all pages
for await (const page of zapier.listInputFields({
  app: "example-value",
  actionType: "read",
  action: "example-value",
})) {
  // Do something with each page
}

// Or iterate over individual items across all pages
for await (const rootFieldItem of zapier
  .listInputFields({
    app: "example-value",
    actionType: "read",
    action: "example-value",
  })
  .items()) {
  // Do something with each rootFieldItem
}

runAction

Execute an action with the given inputs

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ appstringβœ…β€”β€”App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3')
↳ actionTypestringβœ…β€”read, read_bulk, write, run, search, search_or_write, search_and_write, filterAction type that matches the action's defined type
↳ actionstringβœ…β€”β€”Action key (e.g., 'send_message' or 'find_row')
↳ connectionstring, 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. Mutually exclusive with connectionId.
↳ inputsobjectβŒβ€”β€”Input parameters for the action
↳ timeoutMsnumberβŒβ€”β€”Maximum time to wait for action completion in milliseconds (default: 180000)
↳ pageSizenumberβŒβ€”β€”Number of results per page
↳ maxItemsnumberβŒβ€”β€”Maximum total items to return across all pages
↳ cursorstringβŒβ€”β€”Cursor to start from

Returns: Promise<PaginatedResult<ActionResultItem>>

Example:

// Get first page and a cursor for the second page
const { data: actionResults, nextCursor } = await zapier.runAction({
  app: "example-value",
  actionType: "read",
  action: "example-value",
});

// Or iterate over all pages
for await (const page of zapier.runAction({
  app: "example-value",
  actionType: "read",
  action: "example-value",
})) {
  // Do something with each page
}

// Or iterate over individual items across all pages
for await (const actionResult of zapier
  .runAction({
    app: "example-value",
    actionType: "read",
    action: "example-value",
  })
  .items()) {
  // Do something with each actionResult
}

Apps

apps.{appKey}

Bind a connection alias or numeric connectionId to an app

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ connectionstring, 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.

Returns: Promise<AppProxy>

Example:

const result = await zapier.apps.appKey();

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

Execute an action with the given inputs for the bound app, as an alternative to runAction

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ inputsobjectβŒβ€”β€”
↳ connectionstring, 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.
↳ timeoutMsnumberβŒβ€”β€”Maximum time to wait for action completion in milliseconds (default: 180000)

Returns: Promise<PaginatedResult<ActionResultItem>>

Example:

// Get first page and a cursor for the second page
const { data: actionResults, nextCursor } =
  await zapier.apps.appKey.actionType.actionKey();

// Or iterate over all pages
for await (const page of zapier.apps.appKey.actionType.actionKey()) {
  // Do something with each page
}

// Or iterate over individual items across all pages
for await (const actionResult of zapier.apps.appKey.actionType
  .actionKey()
  .items()) {
  // Do something with each actionResult
}

getApp

Get detailed information about a specific app

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ appstringβœ…β€”β€”App slug (e.g., 'github'), implementation name (e.g., 'SlackCLIAPI'), or versioned ID (e.g., 'github@1.2.3')

Returns: Promise<AppItem>

Example:

const { data: app } = await zapier.getApp({
  app: "example-value",
});

listApps

List all available apps with optional filtering

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ searchstringβŒβ€”β€”Search term to filter apps by name
↳ pageSizenumberβŒβ€”β€”Number of apps per page
↳ appsarrayβŒβ€”β€”Filter apps by app keys (e.g., 'SlackCLIAPI' or slug like 'github')
↳ maxItemsnumberβŒβ€”β€”Maximum total items to return across all pages
↳ cursorstringβŒβ€”β€”Cursor to start from

Returns: Promise<PaginatedResult<AppItem>>

Example:

// Get first page and a cursor for the second page
const { data: apps, nextCursor } = await zapier.listApps();

// Or iterate over all pages
for await (const page of zapier.listApps()) {
  // Do something with each page
}

// Or iterate over individual items across all pages
for await (const app of zapier.listApps().items()) {
  // Do something with each app
}

Client Credentials

createClientCredentials

Create new client credentials for the authenticated user

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ namestringβœ…β€”β€”Human-readable name for the client credentials
↳ allowedScopesarray❌["external"]β€”Scopes to allow for these credentials

Returns: Promise<any>

Example:

const result = await zapier.createClientCredentials({
  name: "example-value",
});

deleteClientCredentials

Delete client credentials by client ID

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ clientIdstringβœ…β€”β€”The client ID of the client credentials to delete

Returns: Promise<any>

Example:

const result = await zapier.deleteClientCredentials({
  clientId: "example-id",
});

listClientCredentials

List client credentials for the authenticated user

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ pageSizenumberβŒβ€”β€”Number of credentials per page
↳ maxItemsnumberβŒβ€”β€”Maximum total items to return across all pages
↳ cursorstringβŒβ€”β€”Cursor to start from

Returns: Promise<PaginatedResult<ClientCredentialsItem>>

Example:

// Get first page and a cursor for the second page
const { data: clientCredentials, nextCursor } =
  await zapier.listClientCredentials();

// Or iterate over all pages
for await (const page of zapier.listClientCredentials()) {
  // Do something with each page
}

// Or iterate over individual items across all pages
for await (const clientCredentials of zapier.listClientCredentials().items()) {
  // Do something with each clientCredentials
}

Connections

findFirstConnection

Find the first connection matching the criteria

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ searchstringβŒβ€”β€”Search term to filter connections by title
↳ titlestringβŒβ€”β€”Filter connections by exact title match (searches first, then filters locally)
↳ ownerstringβŒβ€”β€”Filter by owner, 'me' for your own connections or a specific user ID
↳ appstringβŒβ€”β€”App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github')
↳ accountstringβŒβ€”β€”Account to filter by
↳ includeSharedbooleanβŒβ€”β€”Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections.
↳ expiredbooleanβŒβ€”β€”Show only expired connections (default: only non-expired connections are returned)

Returns: Promise<ConnectionItem>

Example:

const { data: connection } = await zapier.findFirstConnection();

findUniqueConnection

Find a unique connection matching the criteria

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ searchstringβŒβ€”β€”Search term to filter connections by title
↳ titlestringβŒβ€”β€”Filter connections by exact title match (searches first, then filters locally)
↳ ownerstringβŒβ€”β€”Filter by owner, 'me' for your own connections or a specific user ID
↳ appstringβŒβ€”β€”App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github')
↳ accountstringβŒβ€”β€”Account to filter by
↳ includeSharedbooleanβŒβ€”β€”Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections.
↳ expiredbooleanβŒβ€”β€”Show only expired connections (default: only non-expired connections are returned)

Returns: Promise<ConnectionItem>

Example:

const { data: connection } = await zapier.findUniqueConnection();

getConnection

Execute getConnection

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ connectionstring, 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.

Returns: Promise<ConnectionItem>

Example:

const { data: connection } = await zapier.getConnection();

listConnections

List available connections with optional filtering

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ searchstringβŒβ€”β€”Search term to filter connections by title
↳ titlestringβŒβ€”β€”Filter connections by exact title match (searches first, then filters locally)
↳ ownerstringβŒβ€”β€”Filter by owner, 'me' for your own connections or a specific user ID
↳ appstringβŒβ€”β€”App key of connections to list (e.g., 'SlackCLIAPI' or slug like 'github')
↳ connectionsarrayβŒβ€”β€”List of connection IDs to filter by
↳ accountstringβŒβ€”β€”Account to filter by
↳ includeSharedbooleanβŒβ€”β€”Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections.
↳ expiredbooleanβŒβ€”β€”Show only expired connections (default: only non-expired connections are returned)
↳ pageSizenumberβŒβ€”β€”Number of connections per page
↳ maxItemsnumberβŒβ€”β€”Maximum total items to return across all pages
↳ cursorstringβŒβ€”β€”Cursor to start from

Returns: Promise<PaginatedResult<ConnectionItem>>

Example:

// Get first page and a cursor for the second page
const { data: connections, nextCursor } = await zapier.listConnections();

// Or iterate over all pages
for await (const page of zapier.listConnections()) {
  // Do something with each page
}

// Or iterate over individual items across all pages
for await (const connection of zapier.listConnections().items()) {
  // Do something with each connection
}

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:

NameTypeRequiredDefaultPossible ValuesDescription
urlstring, customβœ…β€”β€”The full URL of the API endpoint to call (proxied through Zapier's Relay service)
initobjectβŒβ€”β€”Request options including method, headers, body, and authentication
↳ methodstringβŒβ€”GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONSHTTP method for the request (defaults to GET)
↳ headersobjectβŒβ€”β€”HTTP headers to include in the request
↳ bodystring, custom, recordβŒβ€”β€”Request body β€” plain objects and JSON strings are auto-detected and Content-Type is set accordingly
↳ connectionstring, 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.
↳ callbackUrlstringβŒβ€”β€”URL to send async response to (makes request async)
↳ maxTimenumberβŒβ€”β€”Maximum seconds to wait for a response. Honored on a best-effort basis; the server may silently enforce a lower ceiling.

Returns: Promise<Response>

Example:

const result = await zapier.fetch("example-value", { key: "value" });

Tables

createTable

Create a new table

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ namestringβœ…β€”β€”The name for the new table
↳ descriptionstringβŒβ€”β€”An optional description of the table

Returns: Promise<any>

Example:

const result = await zapier.createTable({
  name: "example-value",
});

createTableFields

Create one or more fields in a table

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ tablestringβœ…β€”β€”The unique identifier of the table
↳ fieldsarrayβœ…β€”β€”Array of field definitions to create

Returns: Promise<any>

Example:

const result = await zapier.createTableFields({
  table: "example-value",
  fields: ["example-item"],
});

createTableRecords

Create one or more records in a table

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ tablestringβœ…β€”β€”The unique identifier of the table
↳ recordsarrayβœ…β€”β€”Array of records to create (max 100)
↳ keyModestring❌"names"β€”How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2).

Returns: Promise<any>

Example:

const result = await zapier.createTableRecords({
  table: "example-value",
  records: ["example-item"],
});

deleteTable

Delete a table by its ID

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ tablestringβœ…β€”β€”The unique identifier of the table

Returns: Promise<any>

Example:

const result = await zapier.deleteTable({
  table: "example-value",
});

deleteTableFields

Delete one or more fields from a table

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ tablestringβœ…β€”β€”The unique identifier of the table
↳ fieldsarrayβœ…β€”β€”

Returns: Promise<any>

Example:

const result = await zapier.deleteTableFields({
  table: "example-value",
  fields: ["example-item"],
});

deleteTableRecords

Delete one or more records from a table

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ tablestringβœ…β€”β€”The unique identifier of the table
↳ recordsarrayβœ…β€”β€”Record IDs to operate on

Returns: Promise<any>

Example:

const result = await zapier.deleteTableRecords({
  table: "example-value",
  records: ["example-item"],
});

getTable

Get detailed information about a specific table

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ tablestringβœ…β€”β€”The unique identifier of the table

Returns: Promise<TableItem>

Example:

const { data: table } = await zapier.getTable({
  table: "example-value",
});

getTableRecord

Get a single record from a table by ID

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ tablestringβœ…β€”β€”The unique identifier of the table
↳ recordstringβœ…β€”β€”The unique identifier of the record
↳ keyModestring❌"names"β€”How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2).

Returns: Promise<RecordItem>

Example:

const { data: record } = await zapier.getTableRecord({
  table: "example-value",
  record: "example-value",
});

listTableFields

List fields for a table

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ tablestringβœ…β€”β€”The unique identifier of the table
↳ fieldsarrayβŒβ€”β€”Fields to operate on. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6).

Returns: Promise<PaginatedResult<FieldItem>>

Example:

// Get first page and a cursor for the second page
const { data: fields, nextCursor } = await zapier.listTableFields({
  table: "example-value",
});

// Or iterate over all pages
for await (const page of zapier.listTableFields({
  table: "example-value",
})) {
  // Do something with each page
}

// Or iterate over individual items across all pages
for await (const field of zapier
  .listTableFields({
    table: "example-value",
  })
  .items()) {
  // Do something with each field
}

listTableRecords

List records in a table with optional filtering and sorting

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ tablestringβœ…β€”β€”The unique identifier of the table
↳ filtersarrayβŒβ€”β€”Filter conditions for the query
↳ sortobjectβŒβ€”β€”Sort records by a field
Β Β  ↳ fieldKeystringβœ…β€”β€”The field key to sort by
Β Β  ↳ directionstring❌"asc"β€”Sort direction
↳ pageSizenumberβŒβ€”β€”Number of records per page (max 1000)
↳ maxItemsnumberβŒβ€”β€”Maximum total items to return across all pages
↳ cursorstringβŒβ€”β€”Cursor to start from
↳ keyModestring❌"names"β€”How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2).

Returns: Promise<PaginatedResult<RecordItem>>

Example:

// Get first page and a cursor for the second page
const { data: records, nextCursor } = await zapier.listTableRecords({
  table: "example-value",
});

// Or iterate over all pages
for await (const page of zapier.listTableRecords({
  table: "example-value",
})) {
  // Do something with each page
}

// Or iterate over individual items across all pages
for await (const record of zapier
  .listTableRecords({
    table: "example-value",
  })
  .items()) {
  // Do something with each record
}

listTables

List tables available to the authenticated user

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ tablesarrayβŒβ€”β€”Filter by specific table IDs
↳ kindstringβŒβ€”table, virtual_table, bothFilter by table type
↳ searchstringβŒβ€”β€”Search term to filter tables by name
↳ ownerstringβŒβ€”β€”Filter by table owner. Use "me" for the current user, or a numeric user ID. Requires includeShared to be true.
↳ includeSharedbooleanβŒβ€”β€”Include tables shared with you. Without this, only your own tables are returned.
↳ pageSizenumberβŒβ€”β€”Number of tables per page
↳ maxItemsnumberβŒβ€”β€”Maximum total items to return across all pages
↳ cursorstringβŒβ€”β€”Cursor to start from

Returns: Promise<PaginatedResult<TableItem>>

Example:

// Get first page and a cursor for the second page
const { data: tables, nextCursor } = await zapier.listTables();

// Or iterate over all pages
for await (const page of zapier.listTables()) {
  // Do something with each page
}

// Or iterate over individual items across all pages
for await (const table of zapier.listTables().items()) {
  // Do something with each table
}

updateTableRecords

Update one or more records in a table

Parameters:

NameTypeRequiredDefaultPossible ValuesDescription
optionsobjectβœ…β€”β€”
↳ tablestringβœ…β€”β€”The unique identifier of the table
↳ recordsarrayβœ…β€”β€”Array of records to update (max 100)
↳ keyModestring❌"names"β€”How to interpret field keys in record data. "names" (default) uses human-readable field names, "ids" uses raw field IDs (f1, f2).

Returns: Promise<any>

Example:

const result = await zapier.updateTableRecords({
  table: "example-value",
  records: ["example-item"],
});

Keywords

zapier

FAQs

Package last updated on 30 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts