Apify and n8n: automate scraping with the official node
n8n is an open-source workflow engine you can self-host or run on n8n Cloud. Pairing it with Apify lets you orchestrate scrapers, enrich data, and push results anywhere an API exists.
Apify integrates with n8n via the official Apify node. You can trigger Actor runs, read datasets, and react to webhook events directly from n8n workflows.
This guide covers install and credentials, key operations, example workflows (including Run Actor → Google Sheets), raw HTTP patterns, and webhooks when you prefer not to use community nodes. Canonical reference: Apify’s n8n integration docs.
Why teams use Apify + n8n
| Benefit | What you get |
|---|---|
| No boilerplate | Run Actors and pull datasets without maintaining scraper infrastructure. |
| Composable | Chain Apify with databases, Slack, email, LLM nodes, and custom code. |
| Event-driven | Start flows when runs finish, via the Apify trigger or webhooks. |
| Self-hosting | Keep orchestration on your VPC while Apify handles browser farms and proxies. |
New to visual automation? Make.com is a gentler on-ramp; see our Apify + Make guide.
Method 1: Official Apify community node (recommended)
Package: @apify/n8n-nodes-apify (maintained by Apify, published on npm).
Install
n8n Cloud
- Open a workflow.
- Search the node panel for Apify.
- Click Install when prompted.
- If your org locks community nodes, an admin must allow Verified community nodes under Cloud Admin settings.
Self-hosted n8n
# Typical local/custom install
cd ~/.n8n
npm install @apify/n8n-nodes-apify
For Docker, set community packages per n8n environment docs, for example N8N_COMMUNITY_PACKAGES=@apify/n8n-nodes-apify. Always read n8n’s community node security notes before installing third-party code.
Credentials
- In Apify Console → Integrations, create or copy an API token.
- In n8n, add an Apify credential and paste the token (self-hosted + cloud) or complete OAuth2 (n8n Cloud where supported).
Key operations (what the node can do)
| Area | Typical operations |
|---|---|
| Actors | Run Actor, Scrape single URL |
| Tasks | Run saved Task |
| Runs | Get run, wait for finish |
| Storage | Dataset items, key-value records |
| Triggers | On new Apify event (e.g. run succeeded) |
Useful run options include waitForFinish, memory, timeout, build (tag), and structured JSON input for complex Actors. See Actor input & output.
Apify as an AI tool
n8n can expose the Apify node as a tool inside AI Agent flows so an LLM can request fresh web data mid-conversation. Details are in the AI section of Apify’s n8n docs.
Method 2: Webhooks + HTTP Request (no community node)
Use this when you cannot install community packages or want full control over payloads.
1) Webhook trigger in n8n
- Add a Webhook node as the workflow start.
- Copy the Production URL (or test URL while building).
- In Apify Console → your Actor → Integrations, add a webhook with that URL.
- Set the event to
ACTOR.RUN.SUCCEEDED(or the event you need). - In n8n, execute Listen for test event, then start a run in Apify to capture a sample payload.
Security: Add a secret query param, verify source IPs if your firewall allows listing Apify egress, and remember Apify expects a timely response. See webhook actions & security.
The payload includes run metadata and usually a defaultDatasetId you will use in the next step.
2) Fetch dataset rows with HTTP Request
GET https://api.apify.com/v2/datasets/{{ $json.resource.defaultDatasetId }}/items?clean=true&limit=1000
Authorization: Bearer <YOUR_APIFY_TOKEN>
Depending on the Webhook node version, the dataset id may appear as {{ $json.resource.defaultDatasetId }} or under body. Use the execution preview to copy the exact expression.
3) Minimal curl (debugging outside n8n)
export APIFY_TOKEN="your_token_here"
export DATASET_ID="from_run_object_defaultDatasetId"
curl -s -H "Authorization: Bearer $APIFY_TOKEN" \
"https://api.apify.com/v2/datasets/${DATASET_ID}/items?format=json&clean=true&limit=100"
Example workflows
Template starting point
Browse n8n’s Apify integration page for importable templates, then swap Actor IDs and inputs for your Store Actors.
Example A: Run Actor → Google Sheets
| Step | Node | Notes |
|---|---|---|
| 1 | Manual or Schedule trigger | Cron for nightly catalog sync. |
| 2 | Apify → Run Actor | e.g. Amazon or Maps Actor from the Store. |
| 3 | Apify → Wait for finish or waitForFinish on run | Avoid processing partial runs. |
| 4 | Apify → Get dataset items | Limit rows while testing. |
| 5 | Google Sheets → Append | Map JSON fields to columns; add IF to skip empty rows. |
Example B: Webhook → filter → Slack
- Webhook receives
ACTOR.RUN.SUCCEEDED. - HTTP Request loads dataset items.
- IF node keeps rows where a metric (rating, price, stock) crosses a threshold.
- Slack posts a message with key fields from the item.
Example C: Social monitoring
| Node | Role |
|---|---|
| Schedule Trigger | Daily window |
| Run Actor | Instagram or TikTok Store Actor |
| Get dataset | Normalize media URLs and stats |
| IF | Viral threshold (likes/views) |
| Email / Slack | Alert with permalink |
n8n Cloud vs self-hosted
| Topic | Cloud | Self-hosted |
|---|---|---|
| Setup | Fast, managed | You operate the instance |
| Community nodes | Admin may need to allowlist | Full control |
| Data residency | n8n’s infra | Your servers |
| Cost model | Subscription + usage | Infra + your time |
For regulated data, self-hosted n8n + Apify’s EU data center option (see Apify account settings) is a common pattern.
Troubleshooting (quick table)
| Symptom | Likely cause | Fix |
|---|---|---|
| Webhook never arrives | Wrong URL or event type | Match production URL; confirm ACTOR.RUN.SUCCEEDED. |
| 401 from API | Token revoked | New token in Console → Integrations. |
| Empty dataset | Failed or zero-result run | Read Actor log in Apify; add guard nodes in n8n. |
| Timeouts | Huge export in one call | Pagination + smaller limit. |
More detail is in the frontmatter troubleshooting section above.
Make.com pairs cleanly with Apify for many marketing and ops teams. See Apify + Make.
Install the official @apify/n8n-nodes-apify package. Authenticate with an Apify API token (or OAuth2 on n8n Cloud where available). Then use actions such as Run Actor, Wait for finish, and Get dataset items, or the On new Apify event trigger instead of manual webhooks.
Yes. Use the Apify node’s Run Actor operation on any trigger (schedule, manual, queue). For completion-driven flows, use Wait for finish or the Apify node’s event trigger so you do not maintain webhook URLs yourself.
After a successful run, read items from the default dataset with the Apify node or an HTTP Request to /v2/datasets/{id}/items. Map each item’s fields to a Google Sheets Append or Update row operation; test with a small limit first.
Use an Apify webhook pointing to an n8n Webhook node, then call the Apify REST API with the HTTP Request node using Authorization: Bearer <token>. This mirrors the steps in our Apify API tutorial.
The n8n software is fair-code/open for self-hosting; you pay for your own servers and operations. Compare with n8n Cloud pricing if you want a managed control plane.
Common mistakes and fixes
Community node not visible in n8n Cloud.
Ask a workspace admin to allow **Verified community nodes** (Cloud Admin). Alternatively use **HTTP Request** + **Webhook** as in Method 2.
401 / invalid credentials from the Apify node.
Regenerate the token under [Apify Console → Integrations](https://console.apify.com/account/integrations?fpr=use-apify). For self-hosted n8n, use API token auth; OAuth2 is n8n Cloud–oriented.
Webhook fires but dataset path is empty.
Inspect the execution JSON. The dataset id may be `resource.defaultDatasetId` or nested under `body`. Confirm with one test run before production mapping.
Large datasets time out in one HTTP call.
Use `limit` and pagination (`offset`) on `GET /v2/datasets/{id}/items`, or process in batches inside n8n loops.





