Skip to content
MoveWorkflows

n8n credentials explained

Updated 2026-10-21 · 5 min read

In short
  • Credentials are encrypted with N8N_ENCRYPTION_KEY. Without that key they can't be read.
  • Exported workflows carry credential names and IDs only, never the secrets.
  • Code nodes can't read credentials. Make authenticated calls in HTTP Request or app nodes.
Check my export – free reportRuns in your browser. Nothing is uploaded.
On this page · 9 sections
  1. Create a credential
  2. Credential types you'll use most
  3. Why Code nodes can't read credentials
  4. Sharing
  5. Encryption key
  6. Export and import
  7. Credentials, Variables and environment variables
  8. A credential checklist for migrations
  9. From Pipedream connected accounts

Credentials in n8n are saved login details that nodes use to connect to services: API keys, OAuth tokens, database passwords. They live apart from workflows. n8n encrypts them in its database, and workflows point to them by ID.

That split is why you can export and share workflows safely. It is also why every migration comes with a credential checklist. This page explains how n8n credentials work from start to finish. For moving secrets from Pipedream, see Pipedream secrets to n8n credentials.

Create a credential

There are three ways (docs):

  1. Overview > Create credential, then pick the service. It lands in your personal space.
  2. Inside a project, so the credential belongs to that project. This works on instances with projects.
  3. From a node's Credential dropdown > Create new credential, while you build the workflow.

n8n tests the credential when you save it. A failed test usually has one of three causes. The key is wrong. A scope is missing. Or, on self-hosted n8n, the OAuth redirect URL doesn't match your public n8n URL.

Naming

By default n8n names a new credential "node name account". With ten Slack workspaces, or separate test and production keys, that gets confusing fast. Use a clear pattern instead, such as Slack – Acme workspace – bot or Stripe – live – read-only. It saves time when you reconnect imported workflows.

Allowed HTTP Request Domains

Many credentials have an Allowed HTTP Request Domains field. The choices are All, Specific Domains (comma-separated) or None.

It controls where the credential may be sent when an HTTP Request node uses it. It has no effect in the service's own node. For anything sensitive, set it to the API's domain. Then a typo or a malicious edit can't send your token to another host.

Expressions in credential fields

Credential fields accept expressions. So a credential can take a value from workflow data at runtime. An example is a per-tenant API key (one key per customer account) read from an earlier node. Use this sparingly. The value then sits in the execution data like any other field.

Fixed vs end-user credentials

This applies to OAuth credentials on n8n Cloud Enterprise and self-hosted Enterprise. There you can choose a Credential type:

  • Fixed credential is the default. It is the same credential, whoever runs the workflow.
  • End-user credential uses each user's own connection, private to them.

Credential types you'll use most

Need Credential
A service n8n supports (Slack, Google, HubSpot…) The service's own credential (OAuth2 or API key)
Any REST API with a key in a header Header Auth
A key in the query string Query Auth
Username and password Basic Auth
An OAuth2 provider n8n has no node for OAuth2 API (generic)
Protecting a webhook Basic, Header or JWT auth on the Webhook node

Need an endpoint the app node doesn't cover? Use an HTTP Request node with Predefined Credential Type and reuse the same credential.

Why Code nodes can't read credentials

The Code node has no access to credentials. This is by design: this.getCredentials() and $getCredentials() fail (Code node common issues). n8n intends this pattern instead:

  • Make authenticated calls in HTTP Request or app nodes.
  • Use the Code node to prepare data before the call and to process the response after it.
  • To choose a credential based on the data, route with a Switch node to nodes with different credentials. Or use expressions in credential fields.

This is the biggest change for people coming from platforms where code could read tokens directly.

Sharing

Plan Credential sharing
n8n Cloud All plans
Self-hosted Business, Enterprise Yes
Self-hosted Community No: only the owner and the creator can access a credential

Share from Credentials > (credential) > Sharing, with users or projects (docs). People you share with can use the credential in their workflows. They can't view or edit its details. Instance owners and admins can view and share all credentials.

Encryption key

Credentials are encrypted with N8N_ENCRYPTION_KEY. If you don't set it, self-hosted n8n generates a random key on first launch. It stores that key in the config file in ~/.n8n (deployment variables, backup and restore).

Three rules for self-hosting:

  • Set the key yourself and keep it in your secrets manager. A recreated container with a new random key can't decrypt the existing credentials.
  • Back up the key with the database. One without the other is useless.
  • In queue mode, every worker needs the same key as the main instance.

Export and import

Workflow exports carry credential names and IDs only, never the secrets (export and import). After you import a workflow into another instance, you select or create the credential on each node.

Moving credentials between self-hosted instances is a job for the server's command line (CLI docs):

# encrypted with the source instance's key
n8n export:credentials --all --output=backups/creds.json

# plain text, for a target instance with a different key
n8n export:credentials --all --decrypted --output=backups/decrypted.json

n8n import:credentials --input=backups/decrypted.json

The decrypted file contains every secret in clear text. Create it on the server, move it over an encrypted channel, import it, then delete it. The import keeps IDs. So an imported credential overwrites an existing one with the same ID.

Credentials, Variables and environment variables

Store Use for Readable in Code node
Credentials Secrets that nodes use to log in to services No
Variables ($vars) Non-secret settings shared across workflows (Cloud Pro/Enterprise, self-hosted Business/Enterprise) Yes
Environment variables ($env) Instance settings on self-hosted n8n Only if not blocked
External secrets ($secrets) Secrets kept in an outside vault, Enterprise In credential fields only

Details are in n8n environment variables.

A credential checklist for migrations

  1. List every service the imported workflows use.
  2. For each one, decide: a new OAuth connection, a new API key, or an existing key.
  3. Create the credentials with clear names and set Allowed HTTP Request Domains.
  4. Open each imported workflow, select the credential on every node and save.
  5. Run each workflow once with test data before you publish it.

From Pipedream connected accounts

Pipedream's export turns every secret prop into <redacted>. For connected accounts it keeps only an authProvisionId. Environment variables aren't exported at all (Pipedream export).

Pipedream also deletes connected accounts and OAuth tokens with the rest of the Workflows data by April 30, 2027. So you have to recreate every credential in n8n, with values from the provider.

Our converter report lists, per workflow, which apps need a credential. So steps 1 and 4 above become a checklist, not a hunt. Code steps that read this.<app>.$auth need the call moved to an HTTP Request node. The Code node compatibility check shows which ones. The report and 1 workflow are free. Full export: $3 per workflow, $1 each after 50, $19 minimum, one-off.

Not affiliated with Pipedream or n8n.

FAQ

Where does n8n store credentials?

In the n8n database, encrypted with the instance's encryption key. Self-hosted instances generate a random key on first launch unless you set N8N_ENCRYPTION_KEY.

Are credentials included when I export an n8n workflow?

No. Exported workflow JSON contains only credential names and IDs. You reconnect or recreate the credential after importing.

Can I use a credential inside the n8n Code node?

No. Code nodes can't access credentials by design. Make the authenticated call in an HTTP Request node or an app node instead.

Can I share credentials with teammates in n8n?

On n8n Cloud, on all plans. On self-hosted n8n, on Business and Enterprise. People you share a credential with can use it, but can't see or edit its details.

What happens if I lose the n8n encryption key?

The stored credentials can't be decrypted. Back up the key (or the .n8n folder that holds it) together with the database.