Add a search action
1. Add the action settings
- Open the Actions tab in Zapier’s Platform UI from the sidebar on the left, and select Add Action, selecting your action type. New actions are create type by default, and add new data or update existing data to your app.
Note: You cannot change an action type once you click Save and Continue on a new action. If you need to change the action type, delete the action and recreate it.
- On the Settings page, specify the following:
– Key: A unique identifier for this action, used to reference the action inside Zapier. Does not need to be the same identifier as used in your API. Not shown to users.
– Name: A human friendly plain text name for this action, typically with a verb such as Find or Search followed by the name of the item this action will find in your app. The title-case name is shown inside the Zap editor and on Zapier’s app directory marketing pages.
– Noun: A single noun that describes what this action searches, used by Zapier to auto-generate text in Zaps about your action.
– Description: A plain text sentence that describes what the action does and when it should be used. Shown inside the Zap editor and on Zapier’s app directory marketing pages. Starts with the phrase “Finds a”.
– Visibility Options: An option to select when this action will be shown. Shown is chosen by default.
-
At the bottom of the settings page, you’ll see an option to pair your search with a create action. That lets your action also create an item if the search does not return any results.
-
Click on the Save and Continue button.
2. Complete the Input Designer
On the Input Designer page, add user input fields for this action. All action steps must include an input form for Zapier to gather the data needed to create or find items in your app. Add at least one input field to your action.
Before building your action’s input form, list each piece of data your app needs to find an item. Most search actions only include a single input field, sometimes along with a drop-down menu to select filter data.
3. Set up the API Configuration
In the final API Configuration page, add the API endpoint where Zapier will send the search request to.
A GET
call is used for search actions by default, and sends the data from the input form to your API endpoint.
Zapier expects an array response with 0 or more items. If more than 1 item is returned in the array, Zapier shows only the first match, and parses it into individual fields for use in subsequent Zap steps.
If you prefer your search to return multiple results, return the set of results as an array of objects (line items) under a descriptive key. However, using the standard approach is recommended, because not all integrations support line items directly, so users may need to take additional actions to reformat this data for use in their Zaps, depending which app they pair your search with.
If you’d still like to offer your users a search that returns multiple matches, it is recommended to consider offering both a single item search and multiple item search - for example a Find Record
that returns a single result and a Find Record(s)
that could return multiple results.
For no match found, a 200
with an empty array must be returned to ensure the search step behaves as expected in the Zap editor. A search that returns no results is still considered a successful action step and should not return an error.
If you need to parse the response from the endpoint into the expected response type, switch to Code Mode to write custom JavaScript code for your action.
4. Test your API request
Configure test data to test the search action. Testing a GET request would be expected to return the item from the endpoint.
5. Define your output
Define sample data and output fields following the guide.
Need help? Tell us about your problem and we’ll connect you with the right resource or contact support.