Installation
Initialization
Option 1: Browser-based auth Runningnpx 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.
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:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | No |
Promise<ProfileItem>
Example:
Actions
getAction
Get detailed information about a specific action
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ appKey | string | Yes | App key (e.g., ‘SlackCLIAPI’ or slug like ‘github’) |
↳ actionType | string | Yes | Action type that matches the action’s defined type |
↳ actionKey | string | Yes | Action key to execute |
Promise<ActionItem>
Example:
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:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ appKey | string | Yes | App key (e.g., ‘SlackCLIAPI’ or slug like ‘github’) to get the input schema for |
↳ actionType | string | Yes | Action type that matches the action’s defined type |
↳ actionKey | string | Yes | Action key to get the input schema for |
↳ connectionId | string, number | No | Connection ID to use when fetching the schema. Required if the action needs a connection to determine available fields. |
↳ inputs | object | No | Current input values that may affect the schema (e.g., when fields depend on other field values) |
Promise<InputSchemaItem>
Example:
listActions
List all actions for a specific app
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ appKey | string | Yes | App key of actions to list (e.g., ‘SlackCLIAPI’ or slug like ‘github’) |
↳ actionType | string | No | Filter actions by type |
↳ pageSize | number | No | Number of actions per page |
↳ maxItems | number | No | Maximum total items to return across all pages |
↳ cursor | string | No | Cursor to start from |
Promise<PaginatedResult<ActionItem>>
Example:
listInputFieldChoices
Get the available choices for a dynamic dropdown input field
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ appKey | string | Yes | App key (e.g., ‘SlackCLIAPI’ or slug like ‘github’) |
↳ actionType | string | Yes | Action type that matches the action’s defined type |
↳ actionKey | string | Yes | Action key to execute |
↳ inputFieldKey | string | Yes | Input field key to get choices for. |
↳ connectionId | string, number | No | Connection ID to use for this action |
↳ inputs | object | No | Current input values that may affect available choices |
↳ page | number | No | Page number for paginated results |
↳ pageSize | number | No | Number of choices per page |
↳ maxItems | number | No | Maximum total items to return across all pages |
↳ cursor | string | No | Cursor to start from |
Promise<PaginatedResult<InputFieldChoiceItem>>
Example:
listInputFields
Get the input fields required for a specific action
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ appKey | string | Yes | App key (e.g., ‘SlackCLIAPI’ or slug like ‘github’) |
↳ actionType | string | Yes | Action type that matches the action’s defined type |
↳ actionKey | string | Yes | Action key to execute |
↳ connectionId | string, number | No | Connection ID to use for this action |
↳ inputs | object | No | Current input values that may affect available fields |
↳ pageSize | number | No | Number of input fields per page |
↳ maxItems | number | No | Maximum total items to return across all pages |
↳ cursor | string | No | Cursor to start from |
Promise<PaginatedResult<RootFieldItemItem>>
Example:
runAction
Execute an action with the given inputs
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ appKey | string | Yes | App key (e.g., ‘SlackCLIAPI’ or slug like ‘github’) |
↳ actionType | string | Yes | Action type that matches the action’s defined type |
↳ actionKey | string | Yes | Action key to execute |
↳ connectionId | string, number | No | Connection ID to use for this action |
↳ inputs | object | No | Input parameters for the action |
↳ timeoutMs | number | No | Maximum time to wait for action completion in milliseconds (default: 180000) |
↳ pageSize | number | No | Number of results per page |
↳ maxItems | number | No | Maximum total items to return across all pages |
↳ cursor | string | No | Cursor to start from |
Promise<PaginatedResult<ActionResultItem>>
Example:
Apps
apps.{appKey}
Bind a connection ID to an app
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ connectionId | string, number | No | Connection ID to use for this action |
Promise<AppProxy>
Example:
apps.{appKey}.{actionType}.{actionKey}
Execute an action with the given inputs for the bound app, as an alternative to runAction
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ inputs | object | No | |
↳ connectionId | string, number | No | Connection ID to use for this action |
↳ timeoutMs | number | No | Maximum time to wait for action completion in milliseconds (default: 180000) |
Promise<PaginatedResult<ActionResultItem>>
Example:
getApp
Get detailed information about a specific app
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ appKey | string | Yes | App key of app to fetch (e.g., ‘SlackCLIAPI’ or slug like ‘github’) |
Promise<AppItem>
Example:
listApps
List all available apps with optional filtering
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ appKeys | array | No | Filter apps by app keys (e.g., ‘SlackCLIAPI’ or slug like ‘github’) |
↳ search | string | No | Search term to filter apps by name |
↳ pageSize | number | No | Number of apps per page |
↳ maxItems | number | No | Maximum total items to return across all pages |
↳ cursor | string | No | Cursor to start from |
Promise<PaginatedResult<AppItem>>
Example:
Client Credentials
createClientCredentials
Create new client credentials for the authenticated user
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ name | string | Yes | Human-readable name for the client credentials |
↳ allowedScopes | array | No | Scopes to allow for these credentials |
Promise<any>
Example:
deleteClientCredentials
Delete client credentials by client ID
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ clientId | string | Yes | The client ID of the client credentials to delete |
Promise<any>
Example:
listClientCredentials
List client credentials for the authenticated user
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ pageSize | number | No | Number of credentials per page |
↳ maxItems | number | No | Maximum total items to return across all pages |
↳ cursor | string | No | Cursor to start from |
Promise<PaginatedResult<ClientCredentialsItem>>
Example:
Connections
findFirstConnection
Find the first connection matching the criteria
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ search | string | No | Search term to filter connections by title |
↳ title | string | No | Filter connections by exact title match (searches first, then filters locally) |
↳ owner | string | No | Filter by owner, ‘me’ for your own connections or a specific user ID |
↳ appKey | string | No | App key of connections to list (e.g., ‘SlackCLIAPI’ or slug like ‘github’) |
↳ accountId | string | No | Account ID to filter by |
↳ isExpired | boolean | No | Filter by expired status |
Promise<ConnectionItem>
Example:
findUniqueConnection
Find a unique connection matching the criteria
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ search | string | No | Search term to filter connections by title |
↳ title | string | No | Filter connections by exact title match (searches first, then filters locally) |
↳ owner | string | No | Filter by owner, ‘me’ for your own connections or a specific user ID |
↳ appKey | string | No | App key of connections to list (e.g., ‘SlackCLIAPI’ or slug like ‘github’) |
↳ accountId | string | No | Account ID to filter by |
↳ isExpired | boolean | No | Filter by expired status |
Promise<ConnectionItem>
Example:
getConnection
Execute getConnection
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ connectionId | string, number | No | Connection ID to use for this action |
Promise<ConnectionItem>
Example:
listConnections
List available connections with optional filtering
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options | object | Yes | |
↳ search | string | No | Search term to filter connections by title |
↳ title | string | No | Filter connections by exact title match (searches first, then filters locally) |
↳ owner | string | No | Filter by owner, ‘me’ for your own connections or a specific user ID |
↳ appKey | string | No | App key of connections to list (e.g., ‘SlackCLIAPI’ or slug like ‘github’) |
↳ connectionIds | array | No | List of connection IDs to filter by |
↳ accountId | string | No | Account ID to filter by |
↳ isExpired | boolean | No | Filter by expired status |
↳ pageSize | number | No | Number of connections per page |
↳ maxItems | number | No | Maximum total items to return across all pages |
↳ cursor | string | No | Cursor to start from |
Promise<PaginatedResult<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:
| Name | Type | Required | Description |
|---|---|---|---|
url | string, custom | Yes | The full URL of the API endpoint to call (proxied through Zapier’s Relay service) |
init | object | No | Request options including method, headers, body, and authentication |
↳ method | string | No | HTTP method for the request (defaults to GET) |
↳ headers | object | No | HTTP headers to include in the request |
↳ body | string, custom, custom, record | No | Request body — plain objects and JSON strings are auto-detected and Content-Type is set accordingly |
↳ connectionId | string, number | No | Connection ID to use for this action |
↳ callbackUrl | string | No | URL to send async response to (makes request async) |
Promise<Response>
Example: