Managing n8n API keys and scopes for CI/CD and integrations
A self-hosted n8n instance often ends up receiving calls from deployment pipelines, monitoring tools and line-of-business systems that need to read or change workflows through the REST API. An API key is the credential those callers present, sent in the X-N8N-API-KEY header. It lets the caller do whatever the key's owner could do through the API, so the question for each key is who owns it, what it can reach and how long it lives. Teams need API keys when the caller is a machine or a scheduled job that cannot complete an interactive SSO login. Human users should keep signing in through their identity provider or email login, not hand out keys for convenience.
Scopes and expiry depend on your plan and edition, so confirm them before you design the process. The n8n pricing page lists SSO, LDAP, Git environments and log streaming as Business and Enterprise features, and the feature set for API keys should be checked the same way on your edition's documentation and the n8n pricing page. Also confirm whether your version lets you set an expiry date, label a key and restrict it to specific scopes. Where those controls are missing, plan compensating steps such as a fixed rotation calendar and a record of which pipeline owns each key.
n8n is source-available under the Sustainable Use License, not OSI open source, so your internal use terms apply to how you run the instance and its features. Before you build an API key process, decide three things: one key per pipeline or integration, a named owner for each key, and an offboarding step that revokes keys tied to a departing person or retired system. Test the process in a non-production instance first, confirm the header name and behavior against your installed version, and record the result so auditors can see who could call the API and when access ended.
Key options and when each fits
This table compares the settings you choose when issuing an n8n API key, plus the single-key and shared-key layouts. Read each row for when the option fits, what it trades off in rotation effort, blast radius and attribution, and whether it needs a paid plan. Where a plan requirement is not confirmed in the pricing information, check it with n8n before you design around it.
| Option | When it fits | Trade-off | Plan requirement |
|---|---|---|---|
| Label naming | Keys named for the system, job and owner, such as the illustrative ci-billing-deploy | Labels aid tracing and offboarding but do not limit what a key can do | Confirm with n8n docs |
| Expiry date | Keys for contractors, pilots or jobs with a known end date | Shorter expiry adds rotation work, and a missed rotation stops the pipeline | Confirm with n8n docs |
| Scope selection | Limiting a key to the resources a job needs, such as reading workflow status only | Narrow scopes cut the damage from a leaked key but need upfront design and testing | Reported as Enterprise only; confirm on the pricing page |
| Owning user and role | A service-owner account that stays active when staff change roles | If the key acts with its owner's role, a personal admin account turns every pipeline into an admin path | Confirm with n8n docs |
| One key per pipeline | Each CI/CD job, integration or script with its own label and owner | More keys to track and rotate, but revoking one key stops only one pipeline | Confirm with n8n docs |
| Shared key across pipelines | A small team with one automation owner and a single trusted runner | One revocation breaks every pipeline using it, and usage is hard to attribute to one job | Confirm with n8n docs |
How to issue a key for one pipeline
This sequence gives each CI/CD pipeline or integration its own named key, owned by an identifiable account, with an expiry and limited access. Each step ends with a check, so every key can be traced and revoked on its own when the pipeline changes or its owner leaves.
Confirm the owning account for the key
Decide which user will own the key. Use a dedicated service-style account for the pipeline where your plan and identity setup allow it, so the key does not depend on one employee's login. Record the owner's name, the owning team and the system the key serves in your inventory. Confirm with your n8n administrator that the account's role limits what the key can reach, because a key acts with its owner's permissions. Done when the account exists, is active and has the role you intend for this pipeline.
Create one key for each pipeline
Open the owning account's settings in n8n and create a new API key for this pipeline only. Give it a label that names the system and the environment, for example a reconciliation job in staging (illustrative). Never reuse a key across two pipelines, because revoking a shared key breaks every job that depends on it. Check the key list: the new key should appear with its label and creation date, and no other pipeline's key should have changed.
Set an expiry date on the key
Set an expiry in the key creation dialog, sized to the rotation interval your security team requires for machine credentials. Ask that team which interval applies in your environment, and record the expiry date in the same inventory entry as the owner. A key without an expiry should have a written reason and a named reviewer. Check that the key list shows the expiry date next to the label before you move on.
Apply scopes where your plan allows
Where scopes are available, limit the key to the operations the pipeline needs, such as reading executions for a status check, and avoid broad access for convenience. Scopes are an Enterprise capability, so confirm availability on your plan with n8n before you design around them. If scopes are not available, treat the owner's role as the access boundary and keep that role narrow. Check the key's details to confirm which scopes are attached.
Store the key in the CI secret store
Copy the key once into your CI/CD secret store as a masked or protected variable, limited to the branch or environment the pipeline uses. Do not place it in workflow JSON, repository files, container images or chat messages, and do not print it in job logs. Check by running a job that tests whether the variable is set without printing its value, then search the job log for the key string. The search should return nothing.
Test the key with a read-only call
From the pipeline runner, send a read-only request with the key in the X-N8N-API-KEY header to an endpoint that lists data, such as workflows. Confirm the endpoint path and response format against the API documentation for your installed n8n version, since endpoints can change between releases. Check that the call returns a success status and the data the owner can see in the interface. Record the result with the key's inventory entry.
Confirm out-of-scope calls fail
Send a request the key should not be allowed to make, such as a write to a workflow the pipeline does not change, or a call to a resource outside the owner's role. Expect a refusal. Record the result. A call that succeeds means the key carries more access than the pipeline needs, so narrow the scope or role and repeat this test before the key is used in production.
Security and operational considerations for keys
An API key grants the same access as the account or pipeline behind it, so its risk depends on where it is stored, who owns it, and how long it lives. The cards below pair each common failure with the control that addresses it, and they are meant to be checked against your own n8n instance and your identity and secrets processes.
Keys leaking into logs and workflow data
A key pasted into an HTTP Request node, a Code node or an execution's input data can be read by anyone who can open that workflow or its execution history. Keys can also surface in reverse proxy access logs when they appear in a query string, and in logs shipped to a central system. Store keys in n8n credentials or your external secrets store, reference them rather than typing them into nodes, and check execution data and proxy logs for the header value after a test run.
One key shared across pipelines
When several CI/CD jobs or integrations use the same key, a leak in one pipeline exposes all of them, and revoking the key stops every consumer at once. Issue one key per pipeline, so each key has a single purpose and can be revoked without breaking unrelated work. Record which pipeline uses which key in your inventory so that a revocation request can be answered quickly.
Long-lived keys with no owner
A key created years ago for a project that has since changed is hard to remove because nobody is sure what depends on it. Give every key a named team owner and an expiry date chosen when it is issued, and set a review step that asks the owner whether the key is still needed. Keys without a clear owner or purpose are the first candidates for revocation.
Keys tied to an admin account
A key created by an instance owner or admin inherits that person's broad access, so a pipeline that only needs to trigger one workflow can change users, credentials and settings. Confirm which user each key acts as and which project or scope it reaches. Where your plan supports scopes, grant only the scopes a pipeline uses, and keep administrative actions on personal admin accounts that are subject to MFA.
Rotation during change windows
Rotating a key that a production pipeline depends on can fail the next deployment if the new value is not updated everywhere first. Plan rotation as a two-step change: issue the new key, update each consumer and confirm it works, then revoke the old key. Schedule this inside a change window with the pipeline owner present, and record the rotation date in your key inventory.
Monitoring key use
A valid key used from an unexpected place or at an unusual time may indicate misuse, and a key that is no longer used is a candidate for removal. Review which keys are active, when each was last used and which workflows they trigger, using your own logs and n8n's audit and monitoring features where your edition provides them. Confirm with n8n which key usage events are recorded in your version before you rely on them for detection.
Revoking keys during offboarding
When someone leaves, the goal is to stop their access without breaking the pipelines they built. Keys created under a person's account are often the hidden dependency, so ownership has to move before the account is removed. Removing the person in your identity provider does not end their n8n access on its own, so the keys and the user record must be handled in n8n.
- Inventory their keys first. List every API key created under the leaver's n8n user and match each one to the pipeline or integration that uses it.
- Move dependent pipelines to new keys. Issue replacement keys owned by the team or a service identity, update the CI/CD secret stores, and confirm the pipelines run before the old key is removed.
- Revoke the leaver's keys. Delete or disable each key once its replacement is live, and record who approved the change.
- Transfer and remove the user. Handle workflows and credentials as described in the offboarding topic in this group, then delete the user record in n8n.
Check that no key tied to the leaver is still accepted by n8n and that both the identity provider and n8n show the account as removed.
A retired pipeline should lose its key when its work stops, not weeks later when someone notices the key is still active. A dedicated key per pipeline keeps retirement simple because each key has one consumer. The order still matters: the key should not be removed while something still depends on it.
- Stop the callers first. Deactivate the schedule, webhook or CI job that calls the API so nothing new starts.
- Confirm no remaining use. Check recent API activity and CI logs for requests made with the key before deleting it.
- Remove the secret from the pipeline. Delete the stored key from the CI/CD variable store or secrets manager so a copied job or forked repository cannot reuse it.
- Revoke and document the record. Delete the key in n8n and keep the label and a ticket reference so the audit trail shows why it was removed and when.
Check that the revoked key is rejected on a test call and that no other pipeline or integration references its label.
If a key may have been exposed, revoke it first and investigate second. Exposure can happen through a committed file, a build log, a shared chat message or a copied configuration file. Revoking stops further use, but it does not reverse anything the key already did, so the review that follows matters as much as the revocation itself.
- Revoke immediately. Disable the key in n8n as soon as exposure is suspected, before the cause is confirmed, and expect the dependent pipeline to fail until a replacement is in place.
- Issue a replacement through a controlled path. Create a new key with the narrowest scope that still works, store it in the secrets manager, and restore the pipeline.
- Review what the key did. Use the execution history and any audit records your n8n edition provides to list workflows changed or run, and API calls made, during the exposure window. Confirm which logs are available in your version.
- Rotate what the key could reach. Rotate credentials stored in n8n that the key could read or use, along with downstream system secrets referenced by affected workflows.
- Remove the source of exposure. Purge the repository history, logs or messages where the key appeared, and check that secret scanning or log redaction would catch it next time.
Record the exposure window, the actions reviewed and the rotations completed so the incident can be closed with evidence.
Limits to confirm in your environment
API keys look simple, but what they can do depends on your n8n version, your edition and how your instance is configured. The cards below list the questions to answer with n8n or in a test instance before you build CI/CD pipelines and integrations on top of keys.
Which scopes exist
Confirm which API key scopes your n8n version offers and whether your edition includes them. Scope names and granularity change between releases, so a scope list copied from another instance or an old guide may not match yours. Create a test key in a non-production instance, list its scopes, and record the exact names in your runbook. Then confirm that a key with only the scopes a pipeline needs cannot call endpoints outside them.
n8n release notesWhether expiry is enforced
Ask whether expiry is enforced on your edition or only recorded as a label. A key that never expires after a pipeline is retired is a standing credential. In a test instance, create a key with a short expiry, confirm it stops working at that time, and check whether the instance warns owners before it lapses. Record who is responsible for renewal, since an expired key can break a deployment job without warning.
How keys appear in audit trails
Confirm what your logs show when a key is used. Check whether the key label, the owner and the action are recorded, and whether the key itself is ever written to logs, execution data or log streams. Log streaming is listed on the Business and Enterprise plans, so confirm which of your plan's log outputs carry API activity. Test by making a request with a labeled key and tracing it through your log pipeline.
Project-level restriction
Ask whether a key can be limited to specific projects or whether it inherits the access of its owner across the instance. A key that reaches every project is a larger risk than the scope list suggests. Create two projects in a test instance, issue a key from a user with access to both, and confirm whether the key can read the second project after you have tried to limit it. Document the answer before you give keys to a shared pipeline.
Workflows after owner deletion
Confirm what happens to workflows and integrations that authenticate with a key when the key's owner is deleted or removed. Offboarding a user may disable their keys, break scheduled jobs or leave keys running under an account no one watches. Test this in a non-production instance: delete a test owner, then check whether the key still works, whether the workflows that call it still run, and who receives any error. Plan the transfer before you remove anyone.
How a pipeline call reaches n8n with a key
The flow starts in a CI job or integration that reads its API key from a secret store and sends it in the X-N8N-API-KEY header. n8n checks the key against its stored record, then applies the permissions of the user who owns it. An admin revokes the key directly, which cuts off the pipeline without touching the owner's login. Check that each pipeline has its own key, that the owner's role is limited to what the job needs, and that the revocation step is part of offboarding.
Pipeline requests pass a header check, then the owning user's role and scopes.
Questions teams ask before issuing n8n API keys
Can our team issue n8n API keys without outside help?
Yes, if one or two people can work through the whole lifecycle. The work is to decide which pipelines need a key, give each key a label and expiry, store the secret in your secret manager, update the pipeline configuration to send the key in the X-N8N-API-KEY header, and write down how each key is revoked. Your team needs an admin account on the instance, a test instance to try keys before production, and someone who knows which API operations each pipeline calls. Outside help usually pays off when the pipeline count is high, the scope design is unclear, or auditors will ask for evidence. Confirm whether scoped keys are available on your edition before you plan around them.
What drives the effort of an n8n API key rollout?
Four factors move the effort most:
- The number of pipelines and integrations that will hold a key, since each one needs its own label, secret, configuration change and test.
- Scope design, meaning how narrowly each key is limited to the operations it needs, which depends on how well you know your automation's calls.
- Secret store integration, if keys must be pulled from your existing vault or CI variables rather than typed into configuration by hand.
- Audit needs, such as who issued each key, when it expires, how revocations are recorded and how reviewers will check the record.
A small set of keys in one team's pipelines is a short exercise. A rollout across many teams, environments and secret stores is a project with its own review cycle.
What do we need to provide before API key work starts?
The work needs three things from your side:
- An admin account on the n8n instance, so the team can create keys, set labels and expiry, and revoke them.
- An Enterprise license if you want scoped keys. Confirm this against n8n's current plan details before you commit, because plan contents can change.
- A test instance that matches production closely enough to prove that a pipeline works with its new key and fails correctly after revocation.
You will also need a list of pipelines, the owner of each one, the systems each one calls, and the secret store your organization uses. Those inputs make the written scope accurate, and they shorten the discovery phase.
Does issuing API keys fit our n8n plan?
It depends on the edition and the features you need, so check the plan before you design around it. n8n's pricing page lists a free self-hosted Community edition, cloud Starter and Pro plans, a self-hosted Business plan, and Enterprise at custom pricing. The same page states that SSO and LDAP, environments with Git and log streaming are included only in the Business and Enterprise plans. Scoped keys are the part most likely to depend on your plan, so confirm with n8n which edition includes them before you write the scope. Read the current n8n pricing page and ask n8n to confirm any feature your design depends on.
How long does n8n API key setup usually take?
The duration depends on the drivers, not on a fixed number. A small instance with a few pipelines, a clear owner for each one and an existing secret store can be configured quickly. Longer timelines come from many pipelines, unclear scopes that need testing, secret store integration that needs network or access approvals, and audit evidence that must be produced and reviewed. Ask for a timeline that lists each phase and the inputs it depends on, such as admin access, a test instance and sign-off from the pipeline owners. A timeline based on those inputs is more useful than a single figure.
How do we get a partner quote for n8n API key work?
Send a written scope first. It should list the pipelines and integrations that need keys, the owner and target system of each one, the secret store that will hold the keys, the environments involved (for example, test and production), your audit and evidence requirements, and any deadlines. DeployOpen works on fixed scope, with deliverables and timelines agreed in writing before work starts, and it does not publish a price list. The quote follows from that written scope, so a complete scope produces a more accurate quote. Ask the partner to state what is one-time work and what recurs, such as key reviews, rotations or retainer support.
Should one API key serve all of our n8n pipelines?
No. Give each pipeline its own key so that revoking one key affects one pipeline and leaves the others running. Shared keys make it hard to tell which system made a call, and a leaked key then exposes every integration at once. Illustrative example: a billing sync and a reporting export each get a separate key with a label naming the pipeline and its owner. When the billing sync is retired, only its key is revoked. Keep the label, owner and expiry for every key in a register that your offboarding and review steps can use.
How DeployOpen scopes and supports n8n API key work
DeployOpen starts with an inventory of every n8n API key your organization depends on. For each key we record the pipeline, integration or person that uses it, the owner accountable for it, the label and expiry date in place, and the scope it holds. The inventory also captures which keys belong to instances that are not yet under control, such as a key created for a one-off test that still works. Scope options depend on your n8n edition and plan, so the first check is to confirm which scopes your instance exposes and which ones your current plan includes. Your team can start this work now by exporting the list of existing keys from the instance and matching each one to a named owner.
Next, we design the one-key-per-pipeline model and write the issuance and revocation runbooks. Each CI/CD job or integration gets its own key, so revoking one key during an incident or offboarding does not break unrelated automation. The runbook covers who may request a key, how the label and expiry are set, where the key is stored (typically a CI secret store, referenced in requests as the X-N8N-API-KEY header), and how the key is handed over without being pasted into chat or tickets. The revocation runbook sets the order of steps when someone leaves or a pipeline is retired, and says who verifies that the old key is rejected. Testing confirms that each key can reach only the endpoints its scope allows and that revoked keys fail.
The work runs under a fixed scope agreed in writing before anything changes on your instance. The written scope lists the pipelines and instances covered, the deliverables (inventory, runbooks, test results and handover notes), and what is out of scope, such as changes to identity provider settings. Cost drivers are the number of pipelines, the number of n8n instances and environments, and how many CI platforms need to be wired into the key store. Ask any provider to state these drivers in the quote. Once the initial work is delivered, ongoing support is available as a retainer for key reviews, scheduled rotation, retesting after upgrades and offboarding support.

