Promoting n8n workflows through CI/CD with the public API
A platform team that wants workflow changes to leave development through a pipeline, instead of through manual exports and imports, can drive n8n from that pipeline. n8n exposes a public API, and its source control integration lets a Git repository hold the workflow state that moves between instances. The catch is plan scope: the environments feature that supports Git-based promotion is included only in the Business and Enterprise plans, according to n8n's pricing page. Confirm that tier before designing anything, because a Community or Starter-level instance will not give you the same source control status and push and pull behavior. Teams usually need this pattern when they run several instances (development, staging and production), when a change must pass a review gate before it reaches production, or when an auditor will ask who changed a workflow, when, and through which approval. A pipeline makes each of those steps repeatable and recorded.
The design decisions sit in a few places. Each pipeline should use its own API key, scoped and rotated separately, so that a compromised job does not expose every instance. The pipeline also needs a clear rule for which branch maps to which instance, and for where approvals happen: in the Git provider's merge request or pull request rules, which keeps the record outside n8n. Rollback then becomes a Git operation, reverting a commit and letting the pipeline redeploy, although n8n's own version history is a separate record that you should compare with Git before relying on it. Endpoint names, request bodies and push and pull behavior change between releases, so your team must confirm every endpoint against the n8n version you have installed, and test the pipeline on a non-production instance first. DeployOpen scopes this work as part of fixed-scope engagements: the pipeline design, API key handling, approval flow, rollback runbook and a test run agreed in writing before work starts.
Before you commit to a pipeline, ask three questions. Which plan will host the environments, and does it include the Git feature at the version you will run? Where do credentials live in each environment, since the Git repository should never hold secret values that differ per instance? And who can approve a promotion, and does that approval get recorded in the Git provider where your auditors will look? If any answer is unclear, treat it as an open item in the scope rather than an assumption. Plan for a failed promotion as well as a successful one, including what happens when the pipeline pushes a workflow that depends on a credential the target instance does not have.
Promotion path from development to production
The path starts on a developer n8n instance where a workflow change is made and saved to a feature branch in the Git repository. A merge request in the Git provider carries the change through review and approval before it reaches the protected branches. A CI pipeline then calls the n8n public API to pull the approved state into the staging instance and, after its own checks, into production. Each instance sits behind its own trust boundary, so the Git provider and the pipeline only reach n8n through scoped API keys. A rollback reverts the commit in Git and runs the same pipeline again, so the audit trail stays in Git history.
Approved changes flow from a developer instance through Git and CI into staging and production, with rollback through Git history.
Which promotion approach fits which team
This table compares four ways to move n8n workflows from one instance to another: manual export and import, n8n packages, a pipeline driving the public API, and Git-backed environments with native pull and push. Read each row for the team it suits, who must be involved and the limit to confirm before committing. The main takeaway is that the more the process is automated and reviewed, the more source control and access design the team must own.
| Approach | When it fits | Who needs to be involved | Main limit to confirm |
|---|---|---|---|
| Manual export and import | A small team with few workflows and infrequent changes, where a person can check each copy by hand | Workflow owner and one administrator with access to both instances | No audit trail outside the change record, and credentials must be re-entered on the target |
| n8n packages (.n8np) | Teams moving a workflow together with its dependencies between instances without a Git repository | Workflow owner, administrator of the target, and whoever maintains the package manifest | Confirm the feature's current status, since it is a Preview feature, and what the target must supply |
| Pipeline driving the public API | Organizations that want release steps, tests and approvals in their existing CI/CD tooling | Platform or DevOps engineer, security team for API key scope, and the Git provider administrator | Confirm which endpoints your plan and version expose and how API keys are scoped and rotated |
| Git-backed environments with pull and push | Teams that already version work in Git and want one branch per environment with pull requests between them | Workflow owners, reviewers, an administrator who controls who may push and pull, and the Git provider team | Confirm that the Environments feature is included in your plan, since n8n lists it for Business and Enterprise |
How the pipeline differs for staging and production
Development is where changes begin and where the pipeline has the least reach. Engineers build or edit workflows in the development instance, and the pipeline records each change in source control and pushes it to a development branch. Nothing in this stage touches a shared environment, so a mistake stays contained to one branch. Environments with Git are included in the Business and Enterprise plans on the n8n pricing page, so confirm the plan before you design this stage.
- Push to a branch only: The pipeline pushes to a feature or development branch and never writes to the branch that staging pulls from.
- Read status before pushing: Check source control status first so the pipeline does not overwrite edits someone made in the editor after the last sync.
- Scope the API key: Give this pipeline its own API key, limited to the development instance and revocable without affecting other pipelines.
- Reference variables by name: Workflows should point to variables and credentials by name, so environment values stay in each instance. The sibling topic on setting up dev, staging and production instances explains the branch model.
Check that the development pipeline cannot pull into staging or production, and that its key can be revoked on its own.
Staging is the first place a workflow change meets the environment it will run in, so the pipeline pulls here after a merge and runs its tests. The goal is to catch errors in connections, variables and data handling before any production execution depends on them. Staging should hold its own credentials and variable values, which differ from development and production. Staging is also the place to rehearse rollback, so the team sees how a previous version behaves before it is needed.
- Pull after merge: The pipeline pulls only from the branch that receives approved merges, so staging always reflects reviewed code.
- Run tests against staging: Execute test runs or sample executions after the pull and record the results alongside the commit.
- Use staging-only credentials: Connect staging to test accounts or sandbox endpoints. The sibling topic on sharing credentials across teams covers who may see those connections.
- Set variables per environment: Staging values for URLs, identifiers and thresholds belong in the staging instance. The sibling topic on custom variables across environments explains the naming and scope rules.
- Keep the API key separate: Use a staging key that cannot push to production, so a failed staging run cannot change production.
Confirm that a failed test blocks promotion to production and that the team knows who reviews the results.
Production is the only environment where the pipeline pulls after an approval step, and it should also carry a written rollback plan before the first release. Approval happens in the Git provider, where a reviewer signs off on the merge request that the pipeline acts on. Production credentials and variables stay inside the production instance and are never copied from staging. Every pull should leave a record that links the commit, the approval and the instance state.
- Pull only after approval: The pipeline triggers the production pull only when the required approvers have signed off in the Git provider. The sibling topic on workflow reviews covers the approval design.
- Pin the release commit: Record the commit being deployed so the team knows exactly what is live.
- Name the rollback target: Record the last known good commit. Rolling back means pulling that earlier commit through the same pipeline, so the path must be tested in staging first.
- Compare with n8n's own history: Workflow history in n8n is a separate record that depends on plan and retention. The sibling topic on workflow history explains when Git is the better record.
- Restrict production keys: Limit the production API key to the pull endpoint and rotate it on a schedule your security team sets.
Confirm who can approve a production pull and who can trigger a rollback, and that both roles are documented.
Setting up the pipeline step by step
This sequence connects each n8n instance to its own Git branch, gives every pipeline a narrowly scoped API key, and puts approvals and rollback in the Git provider's hands. When it is complete, a change moves from a lower environment to production only through a reviewed commit, and a bad change can be reverted in Git and redeployed.
Confirm plan and edition for Git environments
The platform owner checks the n8n plan before any other work starts. According to the n8n pricing page, environments with Git are included only in the Business and Enterprise plans, and the Business plan is currently self-hosted only. Confirm the edition and license with your n8n account contact and confirm the environment features show as enabled on each instance. This step is done when every instance in the planned pipeline reports the feature as available, and the decision is recorded with the plan name and date. n8n pricing
Create repositories and the branch model
The Git administrator creates the repository in the source control system your organization runs, such as a self-managed GitLab instance or another provider. Define one branch per environment, for example development, staging and production, and protect the production and staging branches so that direct pushes are blocked. Decide which roles may push to each branch and write this down in the repository's contributing notes. This step is done when a test commit to an unprotected branch succeeds and a direct push to a protected branch is refused.
Connect each instance to its branch
The n8n administrator connects each instance to the branch that belongs to its environment, using the source control settings in the n8n interface. Use a separate Git credential for each instance, scoped to its own repository and branch, and keep it out of workflow definitions. Credentials stored in n8n are not carried through Git, so each instance must be set up with its own connection details. This step is done when each instance shows the expected branch and a status check reports no unexpected differences from the branch.
Create one API key per pipeline
The platform owner creates a separate n8n API key for each pipeline, so that a key can be revoked without affecting other jobs. Choose the narrowest access the API offers for that pipeline's role, and confirm the available scopes in the API reference for your n8n version before creating keys. Store each key as a masked secret in the CI system, never in the repository. Test the key with a status call, then with a deliberately out-of-scope call to confirm it is refused. This step is done when the in-scope call succeeds and the out-of-scope call fails.
Write pipeline jobs for status, pull and push
The pipeline engineer writes jobs in the CI system the organization uses, such as a GitLab CI configuration or a Jenkinsfile committed to the repository. Each job calls the status endpoint first, then decides whether to pull changes into the target instance or push changes from it, and stops with a clear error if the status is unexpected. Confirm the exact endpoint paths and request formats in the n8n public API documentation for your version. This step is done when a dry run against a non-production instance produces the expected status output and the job log records the instance, branch and commit.
Add merge request approval rules
The Git administrator configures merge request rules in the Git provider so that merges into the staging and production branches need a set number of approvals from named reviewers. Require the pipeline to pass before a merge is allowed, and restrict who can merge into production. Ask your provider's documentation or account team which approval and merge options are available in your edition. This step is done when a test merge request without the required approval cannot be merged into the production branch, and a merge with approval and a passing pipeline can.
Test rollback by reverting a commit
The pipeline engineer tests rollback on a non-production instance first. Make a small change to a test workflow, merge it through the approval path, then revert the commit in Git and run the pull job against the same instance. Confirm that the workflow returns to its earlier definition and that the pipeline log shows the revert commit as the source. Repeat the same steps for the production branch only after the revert process has been reviewed. This step is done when the non-production instance matches the reverted commit and the team has written down the rollback steps.
Security controls for API keys, approvals and secrets
A pipeline that pushes and pulls n8n workflows holds powerful access to production automation. The six controls below cover how that access is issued, who can approve changes, where secrets are kept, how encryption keys are shared, what gets logged and how the Git provider and runners are protected.
Scope API keys to each pipeline
Issue a separate n8n API key for each pipeline or environment rather than one shared key for all automation. A key tied to one pipeline limits the blast radius if a runner is compromised and makes revocation a targeted action. Record who created each key, which instance it belongs to and the date it must be rotated, and confirm with your n8n plan and version which key scopes are available to you.
SSO and user docsSplit push and approval rights
The identity that pushes a change to a branch should not be the identity that approves it for production. In your Git provider, require a reviewer other than the author and restrict who may merge into the production branch. Check that the pipeline account has no approval rights, so a compromised pipeline cannot approve its own change.
Keep credentials out of Git and exports
Workflow JSON that is committed or exported should reference credentials by name and ID, never contain secret values. Scan commits for tokens and keys before they reach the remote, and treat a decrypted credential export as a secret in its own right. Confirm with your n8n version how credential data is stored in the source control export before you define the review rule.
Manage the encryption key across instances
n8n encrypts stored credentials with an encryption key, and every instance that must read those credentials needs the same key. In queue mode, the main instance's key must be shared with all worker and webhook processor nodes. Keep the key in your secrets manager, rotate it through a planned procedure, and confirm the consequences for stored credentials before any change.
Queue mode docsLog every pipeline action
Record which pipeline identity pushed, pulled, activated or published a workflow, along with the commit and the target instance. Combine n8n's own activity with the Git provider's audit trail so an investigator can match a production change to a reviewed commit. Ask your n8n plan whether log streaming is included and where those events can be sent for retention.
Harden the Git provider and runners
The Git provider and CI runners hold the tokens that reach every n8n instance, so they are high-value targets. Restrict runner registration, keep runners on isolated hosts, limit which jobs can read protected variables, and enable multi-factor authentication for maintainers. Review the Git provider's hardening guidance and test that a leaked runner token cannot reach production without an approval.
GitLab hardening guideHow rollback works when history lives in Git
The usual rollback is a Git operation, not an n8n one. The pipeline reverts the commit that introduced the bad change on the branch that feeds the affected instance, then pushes that revert through the same review and promotion path as any other release. Once the revert lands, the pipeline pulls the restored definitions into the target instance with the same API call it uses for forward releases. This keeps one record of what changed and who approved it, and it means the rollback itself passes through the approval gate in the Git provider rather than being applied by hand in the editor.
Instance-level workflow history is a separate record. It is stored inside each n8n instance, it has its own retention that depends on your plan, and it does not replace the Git log as the system of record. Check the retention and visibility rules for your edition before you rely on in-app history as a fallback, and see n8n workflow history and rolling back changes for how versions are created and kept. A rollback restores workflow definitions only. It does not restore execution data, which stays as it was recorded, and it does not undo credential changes, because credentials live in the instance's database and are encrypted with that instance's key. If a bad release changed a credential reference or a credential itself, the fix is a separate credential action, not a revert.
Rehearse the rollback before you need it. Pick a non-production instance, promote a change that you know is harmless, revert it through the pipeline, and confirm the workflow returns to its earlier definition and that the active state matches what your runbook expects. Record how long the pipeline took, which API key performed each step, and whether any executions that ran during the bad window need manual follow-up. Ask your team to confirm how activation is handled after a pull, because a restored workflow may need to be re-published before it runs again.
Limits to confirm before committing to a pipeline
The pipeline depends on features that vary by plan, version and deployment model. Confirm each limit against your own n8n edition and installed version before you design the release process around it, because a gap found after build usually means rework in the approval and rollback steps.
Plan required for Git environments
Environments with Git, which the pipeline relies on for source control status and promotion, are included in the Business and Enterprise plans rather than the Community edition. Confirm which plan you will run before you design around Git-based promotion, and ask n8n to confirm in writing that the plan you buy includes the feature. Self-hosted Community users will need a different release method.
n8n pricingEndpoints in your installed version
The source control and public API endpoints, their parameters and their response shapes can change between releases. Read the API reference for the exact version you run, then test each push, pull and status call in a non-production instance. Record the version in your pipeline configuration so an upgrade triggers a fresh check.
n8n release notesRate and payload behavior
Confirm how the API handles request rates, payload sizes and bulk operations before you promote large numbers of workflows in one run. Ask n8n, or test on your own instance, whether large workflow exports fail or time out, and build retries with backoff into the pipeline. Also confirm whether any limits depend on how your instance is hosted.
Partial pull support
Find out whether a pull can apply a subset of changed workflows or must bring in the whole branch. If pulls are all-or-nothing, a single broken workflow can block an unrelated release. Test a pull that includes one changed workflow and one unchanged credential reference, and document the outcome before you choose your branch strategy.
Multi-main deployment limits
Multi-main setups, which run several main instances for high availability, are restricted to Enterprise self-hosted deployments. If you plan a highly available instance, confirm how a push or pull behaves while one main instance is restarting, and whether promotion must target a specific main. Without Enterprise, plan a single main with a documented recovery procedure instead.
Queue mode docsSustainable Use License for internal use
The Sustainable Use License permits use or modification for your own internal business purposes, but it restricts distribution. Confirm with counsel that running a pipeline that copies workflows between your own instances, and any use by contractors or affiliates, falls within that grant. Files with .ee in their name require a valid Enterprise License, so check which features your pipeline actually calls.
n8n license textQuestions teams ask before automating n8n promotion
What drives the cost of automating n8n promotion?
Four cost components drive the total: the n8n plan, Git provider seats, the hosting for pipeline runners and engineering time. Git-backed environments are included only in n8n's Business and Enterprise plans, so a Community edition instance cannot use this workflow. The n8n pricing page lists Business at 667 euros per month billed annually, self-hosted only, and Enterprise at custom pricing. On the Git side, GitLab's pricing page lists Premium at 29 US dollars per user per month billed annually, with Free at 0 dollars. Runner hosting and engineering time are not priced in our sources, so ask for them as separate line items. Ask any quote to separate one-time setup from recurring plan, seat, hosting and support costs.
How long does setup take with several n8n instances?
Setup time depends mostly on how many instances are in the chain, how many branches map to them and how many approval rules the Git provider must enforce. A design with a development, staging and production instance needs more decisions than a single pipeline that pushes to one target. Other drivers include whether each instance needs its own API key per pipeline, how many workflows and variables must be carried, and whether reviewers need separate approval paths for each environment. Since engagements are fixed-scope, the timeline is agreed in writing before work starts, and it should list the instance count, approval rules and workflows included. Ask for that schedule to be tied to milestones you can test.
What must we provide before the pipeline work begins?
You need to provide the items that the pipeline cannot be built without:
- Source repositories for the workflow exports, with a branch model agreed for each environment
- Git administrator rights to set branch protection and approval rules in the Git provider
- Access to each n8n instance, including an account that can create the API keys used by the pipeline
- An n8n plan that includes environments with Git, which means Business or Enterprise
- A runner or build environment that the pipeline can use, plus named owners who can approve production changes
Without admin access to the Git provider, approval gates cannot be enforced in the platform, so confirm this early in the scope.
Can our internal team automate n8n promotion alone?
Yes, if the team already runs n8n administration, a Git provider and a CI system, and has someone who can own the pipeline after go-live. The work is mostly configuration: the pipeline calls n8n's source control status and push and pull endpoints, uses an API key per pipeline, and relies on the Git provider for approvals and history. Pipeline definitions are usually code, such as a Jenkinsfile in a repository for Jenkins Pipeline. The skills gap is most often in the points where the pipeline meets the platform: key scoping, credential handling, approval enforcement and rollback. A partner is useful when those points need an independent review or when internal staff cannot take on the build alongside their normal work.
What recurring work follows once promotion is automated?
Automation shifts work into ongoing operations rather than removing it. Expect recurring tasks in several areas:
- Rotating and reviewing the API keys each pipeline uses
- Reviewing approval rules, reviewer lists and branch protection as teams change
- Keeping the runner environment and its dependencies current
- Renewing Git provider seats and reviewing the n8n plan tier
- Applying n8n and Git platform upgrades, including GitLab's required upgrade stops
GitLab lists upgrade stops at x.2, x.5, x.8 and x.11 since 17.5, so the pipeline's Git platform must follow that sequence. Ask any support retainer to define who handles each of these tasks.
How do n8n upgrades affect the promotion pipeline?
n8n uses semantic versioning and ships minor releases roughly weekly, so pipeline tests should run after every upgrade, not only after major ones. n8n 2.43 was released on 6 October 2026, which shows how quickly the version moves. Upgrade instances in a consistent order, usually development first and production last, and confirm that exports from one version import cleanly into the next. Major version upgrades bring breaking changes, so read the n8n release notes before changing any instance. Keep a record of the version on each instance so that a failed promotion can be traced to a specific upgrade.
Which Git and CI platform should run the pipeline?
The choice depends on your existing tooling, licensing needs and how much of the approval logic you want inside one platform. GitLab's source is open core: content under the ee/ directory is covered by the GitLab Enterprise Edition license, while the rest is under the MIT Expat license. GitLab Premium adds advanced CI/CD and priority support, and Ultimate adds compliance and security features. Jenkins is distributed under the MIT License, and its Pipeline builds are defined in a Jenkinsfile committed to source control. Jenkins requires you to plan the controller, agents and backups yourself, and its LTS releases should be checked against your Java version. Confirm the licensing terms that apply to each component in your environment before you decide.
What DeployOpen delivers and what you keep
Most CI/CD promotion work is a fixed-scope engagement. Before work starts, DeployOpen and your team agree in writing which n8n instances are in the pipeline, which Git provider and project structure hold the workflow source, how branches map to environments, which pipeline jobs call the push and pull endpoints, and which API keys each pipeline uses. The written scope also names the approval steps in your Git provider, the rollback rehearsal and the handover items. Ask for the scope to list each of these as a deliverable so you can check it against your own release process before any build begins.
The rollback rehearsal is the step most often skipped, and it is the one that shows whether the pipeline can be trusted. DeployOpen runs a planned rollback in a non-production instance, using the Git history to restore a previous workflow version and confirming that the change reaches the target instance with the expected behavior. Handover then covers the pipeline definitions, the branch protection and approval rules, the API key inventory and the runbook for a failed promotion. Confirm with the delivery lead exactly which artifacts you receive and in what form, since the written scope governs what is delivered.
You keep ownership of everything the pipeline depends on. Your organization holds the Git provider account, the repositories, the n8n instances, the encryption keys and the API keys issued to each pipeline, and DeployOpen works inside those accounts during the engagement. DeployOpen does not issue audit reports, attestations or certifications for the promotion process. If an auditor needs evidence of change control, DeployOpen can help prepare the records the pipeline produces, but the independent auditor or certification body makes the assessment. Confirm before signing who holds administrator access after handover and how access is revoked.
How DeployOpen scopes and supports n8n promotion pipelines
DeployOpen approaches n8n promotion as a written, fixed-scope piece of platform work inside your own infrastructure. We agree which environments, pipelines, API keys and approval points are in scope, build the promotion path against your instances, and hand over the pipeline with documentation your team can run and change.
How we scope
- We confirm which n8n instances, environments and workflow projects the pipeline will promote between.
- We map your Git provider, approval rules and who may trigger each promotion step.
- We agree in writing which credentials, variables and secrets stay per instance and out of the pipeline.
How we build
- We build the pipeline against your n8n version and confirm which source control endpoints your edition exposes.
- We create one API key per pipeline with the narrowest access the promotion steps need.
- We test rollback by restoring a previous Git revision on a non-production instance before go-live.
How we hand over
- We deliver pipeline definitions, branch and approval diagrams, and a runbook for failed promotions and rollbacks.
- We document key rotation, the owner of each pipeline secret, and the steps to add a new environment.
- We walk your engineers through a supervised promotion so they can run the next release without us.
How we support
- Ongoing support, upgrades and continuous testing are available as a retainer after handover.
- We can retest the pipeline after each n8n upgrade and after changes to your Git provider configuration.
- Any follow-on work is quoted from a new written scope, so the support boundary stays clear.

