Integrate n8n with Strapi
Connect Strapi with n8n to automate content operations without writing custom middleware. Use the visual node editor to build webhook-triggered workflows, perform CRUD operations on your CMS, and distribute content across multiple channels—all with built-in retry logic and error handling
These integration guides are not official documentation and the Strapi Support Team will not provide assistance with them.
What Is n8n?
n8n is an open-source workflow automation platform built with Node.js, featuring a visual node-based editor and backend execution engine. Unlike cloud-only platforms, n8n operates under a Sustainable Use License: you get full source code access and can self-host on your infrastructure without licensing fees, though you can't resell it as a competing hosted service.
The architecture centers on nodes, discrete workflow components connected in directed graphs where data flows through the automation pipeline. Trigger nodes initiate execution from webhooks, scheduled cron jobs, manual activation, or app-specific events.
Action nodes perform operations, including API calls, database queries, and data transformations. Logic nodes implement conditional branching and loop execution, while Function nodes execute custom JavaScript or Python code inline for advanced data processing.
Self-hosting options include Docker containers, Kubernetes, or npm. The comprehensive REST API lets you manage workflows programmatically, trigger executions, and integrate with CI/CD pipelines: all capabilities fully available in self-hosted deployments.
Why Integrate n8n with Strapi
When you're building content-driven applications, the middleware layer between your CMS and external services becomes operational overhead. You write webhook handlers, API client code, retry logic, and transformation functions that aren't differentiating features; they're just necessary plumbing. This is where n8n's integration with Strapi changes the equation.
Most teams discover this pain point after their third or fourth integration. You start with a simple webhook handler, then add retry logic when the external API times out, then implement a queue when you realize you're losing events during deploys. Before you know it, you're maintaining infrastructure that has nothing to do with your core product.
The integration provides a code-free automation layer through two mechanisms: a Strapi Application Node for native CRUD operations (Create, Delete, Get, Get Many, Update) and webhook-based event triggers that react to Strapi lifecycle events without polling.
You get automatic authentication handling, simplified operations for standard use cases, and the flexibility to drop down to HTTP Request nodes when you need complete control.
For event-driven architecture, Strapi webhooks fire on specific lifecycle events: entry.create, entry.update, entry.publish, entry.delete for content, plus media.upload, media.update, and media.delete for files. You can configure these in Strapi's admin panel to target n8n webhook URLs, and each event includes an X-Strapi-Event header for type identification. No Express.js handlers, no API gateway services, no polling mechanisms checking for changes every few minutes.
Bidirectional communication is supported through the Strapi node's Update operation, enabling external service responses to write back to Strapi and update content metadata. This pattern is particularly valuable for workflows that process external data and need to store results in Strapi.
The fundamental advantage is eliminating a custom middleware layer while preserving the ability to orchestrate complex multi-service workflows.
You're not locked into simplified automation: Function nodes provide full JavaScript execution for complex transformations, and HTTP Request nodes give you complete API flexibility when the dedicated Strapi node doesn't cover your use case.
How to Integrate n8n with Strapi
Integration follows a pattern you've likely seen before: generate credentials in one system, configure them in the other, then build workflows that move data between them. The specific implementation details matter here because Strapi v4 introduced breaking changes to the API response structure that will trip you up if you're not aware.
Most notably, Strapi v4 requires all POST and PUT requests to wrap payload data in a data object, and responses nest content attributes under both data and attributes layers, requiring careful data extraction in your workflows.
Prerequisites
You'll need Node.js Active LTS or Maintenance LTS versions installed. Strapi supports Node.js v20 and v22, along with other Active and Maintenance LTS versions. The n8n Strapi node was built for Strapi v3 and has known compatibility issues with Strapi v4 and v5; users working with these newer Strapi versions should use the HTTP Request node for custom API calls as a workaround.
For n8n deployment, choose between self-hosted options (Docker containers, npm package, or desktop application) or the managed n8n.cloud service.
Self-hosting gives you complete control over database connections, security settings, and webhook configurations through environment variables, with full access to the REST API and webhook functionality without pricing tier restrictions. The cloud deployment handles infrastructure automatically while maintaining the same integration capabilities.
Strapi instances must be network-accessible from your n8n installation. Production deployments require HTTPS with valid SSL certificates. For development with self-signed certificates, temporarily disable SSL verification in HTTP Request node settings (never in production).
API authentication requires either API tokens (recommended) or user account credentials. API tokens provide scoped authentication for automation workflows and can be deleted and recreated without password changes.
Connecting n8n to Strapi API
Head to Strapi's admin panel under Settings → Global settings → API Tokens. Create a new token with a descriptive name like "n8n-integration" and select token duration based on your security policies. Choose token type based on your needs: Read-only, Full access, or Custom permissions per content type.
Copy the token immediately; Strapi displays it only once.
In n8n, you'll want to navigate to Credentials → Add Credential and search for "Strapi API". You'll configure three required fields: API Token (paste your token), URL (your Strapi instance base URL without trailing slashes or /api path), and API Version. The URL format matters: https://your-strapi-instance.com for production or http://localhost:1337 for local development. Don't include /api; n8n adds this automatically.
Test the connection. Common failures: expired tokens, incorrect URL formats, or permission issues. If the test succeeds, save the credential for reuse across workflows.
For advanced use cases requiring custom endpoints or operations not covered by the dedicated Strapi node, use the HTTP Request node with Bearer Token authentication. Add your API token under Authentication settings (selecting "Bearer Token" as the credential type), and n8n will automatically include the Authorization: Bearer YOUR_TOKEN header in requests.
Building Trigger Workflows with Strapi Webhooks
Webhook-triggered workflows react to Strapi events without polling or manual execution. In n8n, you'll add a Webhook node to your workflow and configure the HTTP method as POST (standard for Strapi webhooks) with a descriptive path like /strapi-webhook.
Set authentication to Header Auth (recommended for production) with Authorization as the header name and Bearer YOUR_SECRET_TOKEN as the value, matching your Strapi webhook configuration. You'll want to configure the webhook to respond "Immediately" to prevent HTTP timeouts on long-running workflows.
In Strapi's admin panel under Settings > Webhooks, create a new webhook pointing to your n8n endpoint URL. Choose which lifecycle events should trigger the workflow:
entry.create,entry.update,entry.publish,entry.deletefor content operationsmedia.create,media.update,media.deletefor file management
These events provide extensive coverage of most content and media lifecycle changes in your Strapi instance, though certain events (like unpublishing or custom workflow steps) may require additional configuration.
Add the same Authorization header you configured in n8n to secure the connection.
Webhook payloads arrive as JSON with event, model, and entry fields. Access using expressions like $json.event and $json.entry. Developers should customize payloads or apply filtering to exclude private fields and passwords for security.
Test the webhook connection manually in Strapi before relying on it in production. Ensure your n8n workflow is active (not just saved), verify the webhook is enabled in your Strapi admin panel under Settings > Webhooks, and test the connection with manual triggers before production reliance.
Creating Action Workflows for Strapi
Action workflows write data from n8n back to Strapi. A critical technical requirement: Strapi v4+ requires wrapping all POST and PUT request payloads in a data object. Using the dedicated Strapi node does not automatically wrap payloads in a data object as required by Strapi v4+.
To perform 'Create Entry' or 'Update Entry' operations with Strapi v4+, you should manually wrap your data in a data object or use the HTTP Request node for full compatibility. For creating content, specify the content type and provide field values. For updates, include the entry ID and the fields to modify.
When using HTTP Request nodes for more control, structure your POST requests like this:
1{
2 "data": {
3 "title": "New Article",
4 "content": "Article content",
5 "publishedAt": "2025-12-05T10:00:00.000Z"
6 }
7}For managing relationships, pass arrays of IDs. One-to-many relationships such as article to category use a single ID: "category": 5. Many-to-many relationships such as articles to tags use ID arrays: "tags": [1, 3, 7]. To retrieve entries with populated relations, add ?populate=* to GET requests for all first-level relations, or use selective population for specific fields.
Media uploads use the /api/upload endpoint with multipart/form-data. Upload the file first to get a file ID, then reference it in your content entry. For linking during upload, include refId (entry ID), ref (content type), and field (field name) parameters.
Data Transformation and Conditional Logic
Strapi's nested response structure requires transformation before use in workflows. Responses wrap content in data and attributes objects, necessitating extraction using expressions like {{ $json.data.attributes.title }} or {{ $json.data.attributes.content }}.
Use Set nodes for straightforward field mapping: extract nested Strapi attributes into flat structures that downstream nodes expect. For conditional routing, IF nodes handle binary decisions (published vs. draft content), while Switch nodes route based on multiple content types.
When you need array operations, aggregations, or complex transformation logic, drop into Code nodes with JavaScript. A common pattern flattens Strapi's nested response structure into simpler key-value pairs for downstream processing:
1const items = $input.all();
2return items.map(item => ({
3 id: item.json.data.id,
4 title: item.json.data.attributes.title,
5 content: item.json.data.attributes.content,
6 publishedAt: item.json.data.attributes.publishedAt
7}));This transforms Strapi's nested response structure, where content is wrapped in data and attributes objects in Strapi v4+, into a flat object structure that other services and n8n nodes typically expect.
Project Example: Build a Multi-Channel Publishing System
This section demonstrates a production-ready implementation of a multi-channel publishing system that automatically distributes content from Strapi to multiple platforms using n8n workflow automation.
A multi-channel publishing system shows how integration eliminates per-platform code. You write content once in Strapi, and n8n handles distribution to multiple destinations, including social media platforms (Twitter/X, LinkedIn), email services (Mailchimp, SendGrid), and third-party publishing platforms with platform-specific formatting.
When you publish content in Strapi, a webhook triggers n8n with the complete entry payload. A Function node extracts and transforms relevant fields: truncating content for Twitter's 280-character limit, preserving full text for LinkedIn, and formatting for HTML email templates. Generate the public URL using the slug: https://yourdomain.com/blog/${entry.attributes.slug}.
A Switch node routes content based on content type or custom metadata. Different outputs connect to platform-specific nodes: a Twitter node for tweets with excerpt and link, a LinkedIn node for full posts, a Mailchimp node for newsletters, and an HTTP Request node for cross-posting to other platforms via their REST APIs.
For error handling, you'll add IF nodes after each platform node to check HTTP status codes. Route successful responses to data processing and failures to error handling paths. Implement retry logic for transient failures in HTTP Request nodes. Send failures to notification nodes like Slack for operational visibility. Configure webhook response modes to "Immediately" for long-running workflows to prevent HTTP timeouts.
The practical advantage shows up in maintainability. Adding a new distribution platform means adding another branch to your workflow and configuring credentials; no code deployment is required. This is the pattern that saves you during 2 AM incidents.
When your third-party platform integration breaks, you're editing a workflow node instead of hunting through deployment logs to find which microservice needs a rollback. n8n's workflow template library includes importable templates such as "Create, Update, and Get Entry in Strapi" and "Automate Testimonials in Strapi" that demonstrate these patterns.
Strapi Open Office Hours
If you have any questions about Strapi 5 or just would like to stop by and say hi, you can join us at Strapi's Discord Open Office Hours, Monday through Friday, from 12:30 pm to 1:30 pm CST: Strapi Discord Open Office Hours.
For more details, visit the Strapi documentation and n8n documentation.