Skip to content

Commit 38fa41f

Browse files
committed
Add Zapier docs
1 parent 5d971a6 commit 38fa41f

File tree

5 files changed

+630
-0
lines changed

5 files changed

+630
-0
lines changed
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
---
2+
id: directus-zapier-actions
3+
title: Directus Zapier Actions
4+
description: Complete guide for using Directus actions in Zapier workflows, including working with items, users, and files.
5+
technologies:
6+
- zapier
7+
---
8+
9+
This guide covers how to use Directus actions in Zapier to perform operations on your Directus data when triggered by other apps.
10+
11+
**[← Back to Directus + Zapier Overview](/tutorials/workflows/use-directus-with-zapier-for-automation)**
12+
13+
## Using Directus Actions
14+
15+
Directus actions perform operations in Directus when triggered by other apps. You can work with **Items**, **Users**, and **Files**.
16+
17+
## Available Actions
18+
19+
Quick reference of all available actions organized by operation type:
20+
21+
| Operation | Action | Description |
22+
|-----------|-------|-------------|
23+
| **CREATE** | Items – Create | Create a new item in a collection |
24+
| **CREATE** | Users – Invite | Send an invitation email to a new user |
25+
| **CREATE** | Files – Upload | Upload a file from binary data |
26+
| **CREATE** | Files – Import | Import a file from a URL |
27+
| **CREATE** | Items – Update | Update an existing item |
28+
| **CREATE** | Users – Update | Update an existing user |
29+
| **CREATE** | Files – Update | Update file metadata |
30+
| **CREATE** | Items – Delete | Permanently remove an item |
31+
| **CREATE** | Users – Delete | Permanently remove a user |
32+
| **CREATE** | Files – Delete | Permanently remove a file |
33+
| **SEARCH** | Items – Search / List | Find items with optional filters |
34+
| **SEARCH** | Users – Search / List | Find users with optional filters |
35+
| **SEARCH** | Files – Search / List | Find files with optional filters |
36+
| **RAW REQUEST** | Items – Raw Request | Full HTTP method control (POST, PATCH, DELETE) |
37+
| **RAW REQUEST** | Users – Raw Request | Full HTTP method control (POST, PATCH, DELETE) |
38+
| **RAW REQUEST** | Files – Raw Request | Full HTTP method control (PATCH, DELETE) |
39+
40+
---
41+
42+
## Common Operations
43+
44+
Most operations follow a similar pattern. Add **Directus** as an action step, select the operation, choose the collection (for items), and configure fields.
45+
46+
### Create, Update, Delete
47+
48+
These operations work similarly across all resources:
49+
50+
- **Create**: Select operation → Choose Collection (Items only) → Fill in fields → Map data from previous steps as needed
51+
- **Update**: Select operation → Choose Collection (Items only) → Enter ID → Update desired fields
52+
- **Delete**: Select operation → Choose Collection (Items only) → Enter ID
53+
54+
**Note for Items**: All item operations require selecting the **Collection** first. Fields are automatically shown based on your Directus collection structure.
55+
56+
::callout{icon="material-symbols:warning-rounded" color="warning"}
57+
**Permanent Deletion**
58+
Delete operations permanently remove data. Make sure this is what you want to do!
59+
::
60+
61+
### Search / List
62+
63+
Select **Search / List** operation → Choose Collection (Items only) → Configure options:
64+
65+
| Option | Description |
66+
|--------|-------------|
67+
| **File ID** / **Item ID** / **User ID** | Search by specific ID |
68+
| **Fields** | Specify which fields to return (e.g., `id, title, size`) |
69+
| **Maximum number of items to return** | Leave empty to return all matching items (up to 100 by default) |
70+
| **Offset** | Number of records to skip |
71+
| **Page** | Page number for pagination |
72+
| **Sort** | Order results (e.g., `date_created DESC`) |
73+
| **Search** | General search query across attributes |
74+
| **Filter (JSON)** | Advanced filtering using Directus filter syntax |
75+
76+
::callout{icon="material-symbols:warning-rounded" color="warning"}
77+
**Processing Multiple Results**
78+
<br>
79+
By default, Zapier returns only the **first result** from Search / List actions. To process all returned results, you must configure **"If multiple search results are found"** in the action settings to **"Return all results as line items"**. This allows Zapier to process each result separately in subsequent steps.
80+
::
81+
82+
**Note for Items**: Select the **Collection** before configuring options.
83+
84+
::callout{icon="heroicons-outline:light-bulb"}
85+
**Advanced Filtering in Search / List**
86+
<br>
87+
The **Filter (JSON)** field in Search / List actions supports Directus's complete filter syntax, including logical operators (`_and`, `_or`), relational field filtering, and all filter operators. For complete filter syntax and examples, see the [Directus Filter Rules documentation](https://directus.io/docs/guides/connect/filter-rules).
88+
<br>
89+
**Example: Complex filter**
90+
```json
91+
{
92+
"_and": [
93+
{"status": {"_eq": "published"}},
94+
{
95+
"_or": [
96+
{"category": {"_eq": "tutorial"}},
97+
{"category": {"_eq": "guide"}}
98+
]
99+
},
100+
{"views": {"_gt": 100}}
101+
]
102+
}
103+
```
104+
::
105+
106+
## Resource-Specific Operations
107+
108+
### Items
109+
110+
Items are content entries in your Directus collections (blog posts, products, pages, etc.). All operations require selecting a **Collection** first.
111+
112+
::callout{icon="material-symbols:info-outline"}
113+
**Dynamic Field Discovery**
114+
Fields are automatically discovered from your Directus schema and shown in the action configuration. You can map data from previous steps using the dropdown menus.
115+
::
116+
117+
### Users
118+
119+
#### Users – Invite
120+
121+
To create users, use **Users – Invite**. This sends an invitation email so the user can set their password.
122+
123+
**Available options:**
124+
- **Email** (required)
125+
- **Role** (dropdown selection)
126+
- **Custom Invite URL** (optional)
127+
128+
::callout{icon="heroicons-outline:light-bulb"}
129+
**Direct User Creation**
130+
For direct user creation without invitation, use **Users – Raw Request** with POST method.
131+
::
132+
133+
All other operations (Update, Delete, Search / List) follow the standard pattern above.
134+
135+
### Files
136+
137+
Files are images, documents, and other media stored in Directus.
138+
139+
#### Files – Upload
140+
141+
Upload a file from binary data in your Zap.
142+
143+
**Available options:**
144+
- **File** (required) - Binary file data from a previous step
145+
- **Title** (optional)
146+
- **Description** (optional)
147+
- **Folder** (optional)
148+
149+
::callout{icon="material-symbols:info-outline"}
150+
**File Data Source**
151+
The file must come from a previous step that provides binary file data (like downloading a file from a URL or getting a file from another app).
152+
::
153+
154+
#### Files – Import
155+
156+
Import a file from a publicly accessible URL.
157+
158+
**Available options:**
159+
- **File URL** (required) - Must be publicly accessible
160+
- **Title** (optional)
161+
- **Description** (optional)
162+
- **Folder** (optional)
163+
164+
::callout{icon="heroicons-outline:light-bulb"}
165+
**Upload vs Import**
166+
Use **Upload** when you have binary file data from a previous step. Use **Import** when you have a publicly accessible URL to the file.
167+
::
168+
169+
All other operations (Update, Delete, Search / List) follow the standard pattern above.
170+
171+
---
172+
173+
## Tips and Best Practices
174+
175+
176+
177+
178+
### File Fields in Items
179+
180+
When creating or updating items with file/image fields, first upload or import the file using a **File** action, then use the returned **File ID** in your item creation/update. File fields require the UUID of an existing file, not file uploads directly.
181+
182+
### Role Names
183+
184+
When creating or updating users, the **Role** field accepts both role names (e.g., "Editor") and UUIDs. Using role names is easier and more readable.
185+
186+
### Testing Your Zaps
187+
188+
Always test your Zap before turning it on. Click **Test** on each step to verify data flows correctly and field mappings are correct.
189+
190+
---
191+
192+
## Troubleshooting
193+
194+
When working with Directus API through Zapier, you may encounter various error codes. For a comprehensive list of Directus error codes and their meanings, refer to the [official Directus Error Codes documentation](https://directus.io/docs/guides/connect/errors).
195+
196+
### Error Handling
197+
198+
If you get errors:
199+
200+
1. **Permission Errors**: Check that your Directus API token has the right permissions
201+
2. **Not Found Errors**: Verify that the collection, item ID, or user ID exists
202+
3. **Connection Errors**: Make sure your Directus URL is correct and accessible (must include `https://`, no trailing slash)
203+
204+
### Getting Help
205+
206+
If you encounter issues:
207+
208+
1. **For Directus-specific questions:** Ask for help in the [Directus Community](https://community.directus.io/)
209+
2. **For Zapier-specific questions:** Visit the [Zapier Community](https://community.zapier.com) or check [Zapier Help Center](https://help.zapier.com/)
210+
3. **For API connection issues:** Verify your Directus configuration and permissions
211+
212+
---
213+
214+
## Next Steps
215+
216+
- **[← Back to Overview](/tutorials/workflows/use-directus-with-zapier-for-automation)** Return to the integration overview
217+
- **[Learn about Directus Triggers →](/tutorials/workflows/directus-zapier-triggers)** Set up automated workflows
218+
219+
220+
221+
222+
223+
224+
225+
226+
227+

0 commit comments

Comments
 (0)