|
| 1 | +--- |
| 2 | + |
| 3 | +title: n8n integration |
| 4 | +description: Connect Apify with n8n to automate workflows by running Actors, extracting data, and responding to Actor or task events. |
| 5 | +sidebar_label: n8n |
| 6 | +sidebar_position: 7 |
| 7 | +slug: /integrations/n8n |
| 8 | +----------------------- |
| 9 | + |
| 10 | +**Connect Apify with n8n to automate workflows by running Actors, extracting structured data, and responding to Actor or task events.** |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +[n8n](https://n8n.io/) is an open source fair-code licensed tool for workflow automation. With the [Apify integration for n8n](https://github.com/apify/n8n-nodes-apify), you can connect Apify Actors and storage to hundreds of services, so you can run scrapers, extract data, and trigger workflows based on Actor or task events. |
| 15 | + |
| 16 | +This guide shows you how to install the Apify node, configure credentials, and use the available operations and triggers in your n8n workflows. |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +Before you begin, make sure you have: |
| 21 | + |
| 22 | +* An [Apify account](https://console.apify.com/) |
| 23 | +* An [n8n instance](https://docs.n8n.io/getting-started/) (self‑hosted or cloud) |
| 24 | + |
| 25 | +## Install the Apify Node (self-hosted) |
| 26 | + |
| 27 | +You can install the Apify community node directly from the n8n Editor UI: |
| 28 | + |
| 29 | +1. Open your n8n instance |
| 30 | +2. Go to **Settings > Community Nodes** |
| 31 | +3. Select **Install** |
| 32 | +4. Enter the npm package name: `@apify/n8n-nodes-apify` to install the latest version. To install a specific [version ](https://www.npmjs.com/package/@apify/n8n-nodes-apify?activeTab=versions) enter e.g `@apify/[email protected]` |
| 33 | +5. Agree to the [risks](https://docs.n8n.io/integrations/community-nodes/risks/) of using community nodes and select **Install** |
| 34 | +6. The node is now available to use in your workflows |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | +## Install the Apify Node (n8n Cloud) |
| 39 | + |
| 40 | +If you’re using n8n Cloud, installing community nodes is even simpler: |
| 41 | + |
| 42 | +1. Go to the **Canvas** and open the **nodes panel** |
| 43 | +2. Search for **Apify** in the community node registry |
| 44 | +3. Click **Install node** to add the Apify node to your instance |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +:::note |
| 49 | + |
| 50 | + On n8n cloud users can choose not to show verified community nodes. Instance owners can toggle this in the Cloud Admin Panel. To install the Apify node, make sure the installation of verified community nodes is enabled. |
| 51 | + |
| 52 | +::: |
| 53 | + |
| 54 | +## Authentication |
| 55 | + The Apify node supports two authentication methods: |
| 56 | + |
| 57 | + 1. API Key (cloud & self-hosted instance): |
| 58 | + - In the n8n Editor UI, click on **Create Credential** |
| 59 | + - Search for Apify API and click **Continue** |
| 60 | + - Enter your Apify API token. You can find the API token in the [console](https://console.apify.com/settings/integrations) |
| 61 | + - Click **Save** |
| 62 | + |
| 63 | +  |
| 64 | + |
| 65 | + 2. OAuth2 (cloud instance only): |
| 66 | + - In n8n Cloud, click on **Create Credential** |
| 67 | + - Search for Apify OAuth2 API and click **Continue** |
| 68 | + - Click **Connect my account** and authorize with your Apify account |
| 69 | + - n8n will retrieve and store OAuth2 tokens automatically |
| 70 | + |
| 71 | +  |
| 72 | + |
| 73 | + :::note |
| 74 | + |
| 75 | + On n8n Cloud, you're free to authenticate the Apify node either with your Apify API key or via OAuth2. If you prefer simplicity, you can use API Key. |
| 76 | + |
| 77 | + ::: |
| 78 | + |
| 79 | +## Create a Workflow with the Apify Node |
| 80 | + |
| 81 | +1. Create a new workflow in n8n |
| 82 | +2. Click **Add Node**, search for **Apify**, and select it |
| 83 | +3. Select the desired **Resource** and **Operation** |
| 84 | +4. In the node's **Credentials** dropdown, choose the Apify credential you configured earlier. If you haven't configured any credentials, you can do so in this step. The process will be the same |
| 85 | +5. You can now use Apify node as a trigger or action |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | +## Use Apify node as trigger |
| 90 | +1. Create a new workflow |
| 91 | +2. Click **Add Node**, search for **Apify**, and select it |
| 92 | +3. Select **On new Apify Event** trigger |
| 93 | +4. Configure it: |
| 94 | + - **Actor or Actor task**: select the Actor or task to listen for terminal events |
| 95 | + - **Event Type**: the status of the Actor or task run that should trigger the workflow |
| 96 | +5. Add subsequent nodes (e.g., HTTP Request, Google Sheets) to process or store the output |
| 97 | +6. Save and execute the workflow |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | +## Use Apify node as an action |
| 102 | +1. Create a new workflow |
| 103 | +2. Click **Add Node**, search for **Apify**, and select it |
| 104 | +3. Select any operation. In this example we will use **Run Actor** |
| 105 | +4. Configure it: |
| 106 | + - **Custom input**: JSON input for the Actor run, which you can find on the Actor input page in Apify Console. See [Inputs](/platform/actors/running/input-and-output#input) for more information. If empty, the run uses the input specified in the default run configuration |
| 107 | + - **Timeout**: Timeout for the Actor run in seconds. Zero value means there is no timeout |
| 108 | + - **Memory**: Amount of memory allocated for the Actor run, in megabytes |
| 109 | + - **Build Tag**: Specifies the Actor build tag to run. By default, the run uses the build specified in the default run configuration for the Actor (typically `latest`) |
| 110 | + - **Wait for finish**: Whether to wait for the run to finish before continuing. If true, the node will wait for the run to complete (successfully or not) before moving to the next node |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +5. Add another Apify operation called **Get Dataset Items**. |
| 115 | + - Set Dataset ID parameter as **defaultDatasetId** value received from the previous **Run Actor** node. This will give you the output of the Actor run |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | +6. Add any subsequent nodes (e.g. Google Sheets) to process or store the output |
| 120 | +7. Save and execute the workflow |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | +## Available Operations |
| 125 | + |
| 126 | +### Actors |
| 127 | + |
| 128 | +* **Run Actor**: Starts a specified Actor with customizable parameters |
| 129 | +* **Scrape Single URL**: Runs a scraper for a specified website and returns its content |
| 130 | +* **Get Last Run**: Retrieve metadata for the most recent run of an Actor |
| 131 | + |
| 132 | +### Actor Tasks |
| 133 | + |
| 134 | +* **Run Task**: Executes a specified Actor task |
| 135 | + |
| 136 | +### Actor Runs |
| 137 | + |
| 138 | +* **Get User Runs List**: Retrieve a list of all runs for a user |
| 139 | +* **Get Run**: Retrieve detailed information for a specific run ID |
| 140 | +* **Get Runs**: Retrieve all runs for a specific Actor |
| 141 | + |
| 142 | +### Datasets |
| 143 | + |
| 144 | +* **Get Items**: Retrieves items from a [dataset](/platform/storage/dataset) |
| 145 | + |
| 146 | +### Key-Value Stores |
| 147 | + |
| 148 | +* **Get Record**: Retrieves a value from a [key-value store](/platform/storage/key-value-store) |
| 149 | + |
| 150 | +### Triggers |
| 151 | + |
| 152 | +Automatically start an n8n workflow when an Actor or task run finishes: |
| 153 | + |
| 154 | +* **Actor Run Finished**: Activates when a selected Actor run completes |
| 155 | +* **Task Run Finished**: Activates when a selected Actor task run completes |
| 156 | + |
| 157 | +## Resources |
| 158 | + |
| 159 | +* [n8n Community Nodes Documentation](https://docs.n8n.io/integrations/community-nodes/) |
| 160 | +* [Apify API Documentation](https://docs.apify.com) |
| 161 | +* [n8n Documentation](https://docs.n8n.io) |
| 162 | + |
| 163 | +## Troubleshooting |
| 164 | + |
| 165 | +* **Authentication errors**: Verify your API token or OAuth2 settings in **Credentials**. |
| 166 | +* **Operation failures**: Check input parameters, JSON syntax, and resource IDs in your Apify account. |
| 167 | + |
| 168 | +Feel free to explore other resources and contribute to the integration on [GitHub](https://github.com/apify/n8n-nodes-apify). |
0 commit comments