Skip to main content

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.

Quick Answer

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

BenefitWhat you get
No boilerplateRun Actors and pull datasets without maintaining scraper infrastructure.
ComposableChain Apify with databases, Slack, email, LLM nodes, and custom code.
Event-drivenStart flows when runs finish, via the Apify trigger or webhooks.
Self-hostingKeep 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.

Package: @apify/n8n-nodes-apify (maintained by Apify, published on npm).

Install

n8n Cloud

  1. Open a workflow.
  2. Search the node panel for Apify.
  3. Click Install when prompted.
  4. 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

  1. In Apify Console → Integrations, create or copy an API token.
  2. 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)

AreaTypical operations
ActorsRun Actor, Scrape single URL
TasksRun saved Task
RunsGet run, wait for finish
StorageDataset items, key-value records
TriggersOn 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

  1. Add a Webhook node as the workflow start.
  2. Copy the Production URL (or test URL while building).
  3. In Apify Console → your Actor → Integrations, add a webhook with that URL.
  4. Set the event to ACTOR.RUN.SUCCEEDED (or the event you need).
  5. 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>
Expression paths

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

StepNodeNotes
1Manual or Schedule triggerCron for nightly catalog sync.
2Apify → Run Actore.g. Amazon or Maps Actor from the Store.
3Apify → Wait for finish or waitForFinish on runAvoid processing partial runs.
4Apify → Get dataset itemsLimit rows while testing.
5Google Sheets → AppendMap JSON fields to columns; add IF to skip empty rows.

Example B: Webhook → filter → Slack

  1. Webhook receives ACTOR.RUN.SUCCEEDED.
  2. HTTP Request loads dataset items.
  3. IF node keeps rows where a metric (rating, price, stock) crosses a threshold.
  4. Slack posts a message with key fields from the item.

Example C: Social monitoring

NodeRole
Schedule TriggerDaily window
Run ActorInstagram or TikTok Store Actor
Get datasetNormalize media URLs and stats
IFViral threshold (likes/views)
Email / SlackAlert with permalink

n8n Cloud vs self-hosted

TopicCloudSelf-hosted
SetupFast, managedYou operate the instance
Community nodesAdmin may need to allowlistFull control
Data residencyn8n’s infraYour servers
Cost modelSubscription + usageInfra + 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)

SymptomLikely causeFix
Webhook never arrivesWrong URL or event typeMatch production URL; confirm ACTOR.RUN.SUCCEEDED.
401 from APIToken revokedNew token in Console → Integrations.
Empty datasetFailed or zero-result runRead Actor log in Apify; add guard nodes in n8n.
TimeoutsHuge export in one callPagination + smaller limit.

More detail is in the frontmatter troubleshooting section above.

Prefer a hosted low-code UI?

Make.com pairs cleanly with Apify for many marketing and ops teams. See Apify + Make.

Apify Affiliate Banner 300x250Apify Affiliate Banner 300x250Apify Affiliate Banner 300x50Apify Affiliate Banner 300x50
Frequently Asked Questions

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.

Apify Affiliate Banner 728x90Apify Affiliate Banner 728x90Apify Affiliate Banner 300x50Apify Affiliate Banner 300x50