Skip to main content
0 reactions

n8n Tutorial — Part 6: Credentials: Connect n8n to Your Apps

Card titled Connect n8n to Your Apps, labelled n8n Tutorial Part 6 Credentials, showing a padlock with the notes API key, read only, Tested when you save, and Stored encrypted.

Most apps don’t let just anyone in. Before n8n can read or change anything in another app, it has to prove that you allowed it, usually with an API key, a password or a sign-in. In n8n, that proof is a credential: you save it once, n8n tests it and keeps it encrypted, and every node that talks to that app uses it.

In this part you create your first credential, for an app you already have: n8n itself. n8n has its own API, and with a read-only key you read every workflow on your n8n, which is the first half of a nightly backup. The same steps work for every app in n8n’s list.

This is Part 6 of the n8n Tutorial. The parts in Module B, Workflow Basics:

All parts of the n8n Tutorial

Module A: Start Here

Module B: Workflow Basics

Module C: Working with Data

  • Part 9: Items and JSON: How Data Moves in n8n
  • Part 10: Expressions: Use Data from Earlier Nodes
  • Part 11: Transform Data
  • Part 12: Filter and Compare Data
  • Part 13: Dates and Times
  • Part 14: Files: CSV, Excel and PDF
  • Part 15: Data Tables: Store Data Inside n8n

Module D: Flow Logic

  • Part 16: If and Switch: Make Decisions
  • Part 17: Merge: Combine Branches
  • Part 18: Loops and Batches
  • Part 19: Wait and Human Approval
  • Part 20: Sub-workflows
  • Part 21: Error Handling

Module E: Code and APIs

  • Part 22: HTTP Request: Call Any API
  • Part 23: The Code Node in JavaScript
  • Part 24: The Code Node in Python

Module F: AI with Claude

  • Part 25: Your First AI Agent
  • Part 26: Give Your Agent Tools
  • Part 27: Memory That Lasts
  • Part 28: Answer from Your Documents
  • Part 29: AI Chains: Summarize, Classify and Extract
  • Part 30: Human in the Loop and Guardrails
  • Part 31: MCP in n8n
  • Part 32: Evaluations: Test Your AI Workflows
  • Part 33: Free Local AI with the Self-Hosted AI Starter Kit
  • Part 34: An n8n Agent in Microsoft Teams

Module G: Connect Apps and Extend n8n

  • Part 35: Connect Popular Apps with OAuth2
  • Part 36: Community Nodes
  • Part 37: Build Your Own Node
  • Part 38: Programmatic Nodes and Publishing
  • Part 39: The n8n API and CLI
  • Part 40: Build Workflows in Code with the Workflow SDK

Module H: Self-Hosting for Production

  • Part 41: Configure n8n with Environment Variables
  • Part 42: Run n8n on PostgreSQL
  • Part 43: Queue Mode and Workers
  • Part 44: Task Runners and Security
  • Part 45: Back Up, Restore and Update n8n
  • Part 46: Logs, Metrics and Tracing
  • Part 47: Put n8n Online with HTTPS

Module I: Users and Administration

  • Part 48: Users, Roles and Two-Factor Authentication

Module J: n8n Cloud

  • Part 49: Start an n8n Cloud Free Trial
  • Part 50: AI Workflow Builder, Assistant and Gateway Credits

Module K: Wrap-up

  • Part 51: Final Project, Cheat Sheet and What to Learn Next

Cost: free. Everything here runs on your own n8n Community Edition, and n8n’s API is part of it.

Every screen and output on this page is real, run with n8n 2 in Docker on macOS.

Get the Source Code

Get the complete source code of Workflow Backup for n8n on Dewiride Store → (opens in a new tab)
It turns this part’s Back up my workflows example into a finished, tested nightly backup: every workflow saved as a JSON file on your computer, with a key that can only list workflows and n8n in Docker.

What You’ll Build

A workflow named Back up my workflows with two nodes: a manual trigger and the n8n node set to Get many workflows. The n8n node signs in to your n8n’s API with a credential named n8n API (read only) for backups, and its output is every workflow on your n8n, in the same form a backup keeps them. You start from n8n running on your computer.

Prerequisites

Step 1: Create an API Key for n8n

Every app gives you its keys in its own settings, and n8n is no different. Click your name at the bottom of the left sidebar, then Settings, and choose n8n API under Integrations. Click Create API key:

The API page in n8n Settings, with a link to the API playground and a Create API key button, before any key exists.
Settings › n8n API, before the first key.

Fill in the form:

  • Label: a name that says what the key is for, such as Workflow backup.
  • Expiration: keep 30 days. A key that expires stops working on that date, so a forgotten key can’t be misused for ever.
  • Scopes: choose Read only. The key can then read workflows and data but never change anything. Give every key only what its job needs.
The Create API Key form with the label Workflow backup, an expiration of 30 days ending Sun, Dec 27 2026, and the Read only scopes chosen, 37 of 119 scopes selected.
A read-only key named Workflow backup that expires in 30 days.

Click Save. n8n shows the key once and never again. Click the copy button next to it, and keep it for Step 3:

The message API key created successfully, asking to copy the API key now, with the key masked as rows of x, a copy button and a Done button.
n8n shows a new key once. The key is masked here.

Click Done. The key is in the list now, with its 37 scopes and the date it expires:

The list of API keys with one key named Workflow backup, 37 scopes, expiring on 27 Dec 2026.
The new key with its scopes and expiry date.

Keep keys secret. Anyone who has this key can read everything it allows. Don’t paste it into a chat, a document or a node’s field. In Step 3 it goes into a credential, where n8n keeps it encrypted.

Step 2: Add the n8n Node

Create a new workflow named Back up my workflows, click Add first step and choose Trigger manually. Click + after the trigger and search for n8n:

The What happens next panel with n8n typed in the search box, listing n8n Form, n8n with the description Handle events and perform actions on your n8n instance, and Execute Sub-workflow.
The n8n node is second in the results.

Click n8n. Its actions are grouped by what they work on. Scroll to Workflow actions and choose Get many workflows:

The actions of the n8n node, 17 in all, grouped as Audit, Credential, Execution, Project, User and Workflow actions.
Get many workflows is under Workflow actions.

The node opens. Its first field, Credential, is empty and shows a Connect to n8n button: the node can’t do anything until n8n knows how to sign in.

The Get many workflows node with an empty Credential field showing a Connect to n8n button, Resource Workflow, Operation Get Many and Return All switched on.
No credential yet, so the node shows Connect to n8n.

Step 3: Create the Credential

Click Connect to n8n. n8n opens a new credential of the type n8n API, with the two fields this app needs:

  • API Key: paste the key you copied in Step 1. n8n shows it as dots.
  • Base URL: the address of your n8n’s API. For n8n running on your computer, type the address below. On n8n Cloud it’s your instance’s address followed by /api/v1.
Base URLPlain text
http://localhost:5678/api/v1

Leave Allowed HTTP Request Domains on All. It only matters when you use the credential in an HTTP Request node. How to Restrict an n8n Credential to Specific Domains explains it.

A new n8n API credential named n8n account with the API key shown as dots, the Base URL http://localhost:5678/api/v1 and Allowed HTTP Request Domains set to All.
The key as dots, and the address of n8n’s API.

Click Save. n8n tests the credential straight away by calling your n8n’s API with the key. When the test passes, the window closes and the node shows the credential. To see the result, click the pencil next to the credential’s name:

The saved credential with a green Connection tested successfully message and a Retry button above its fields.
n8n tested the credential when it was saved.

Connection tested successfully means the key and the address both work. If you see Couldn’t connect with these settings instead, the line under it says what’s wrong, and the Troubleshooting table below explains both messages you can meet here.

Step 4: Give the Credential a Clear Name

n8n names a new credential after the app, here n8n account. Once you have a few, names like that all look alike. Click the name at the top of the credential and type one that says the app, what the key can do and what it’s for, such as n8n API (read only) for backups. Click Save:

The credential renamed to n8n API (read only) for backups and marked Saved, still showing Connection tested successfully.
A name that says the app, the access and the job.

Close the credential. The node’s Credential field shows the new name.

Advertisement

Step 5: Read Every Workflow

In the node, keep Resource on Workflow, Operation on Get Many and Return All on, then click Execute step. The node signs in with your credential and returns every workflow on your n8n, one item each. On a new n8n that’s just this workflow:

The node’s output in the Schema view: 1 item with the id, the name Back up my workflows, active false, the dates, the versionId and the list of nodes.
One item per workflow, with everything in it.

Each item holds a whole workflow: its name, whether it’s published, its nodes and how they connect. That is everything a backup needs to rebuild it. Switch the output to JSON and find this workflow’s own n8n node to see how a workflow refers to a credential:

Output (excerpt)JSON
"name": "Get many workflows",
"credentials": {
  "n8nApi": {
    "id": "xR6SHUgK4mCw5iIa",
    "name": "n8n API (read only) for backups"
  }
}

A workflow keeps only the credential’s name and ID, never the key. When you export a workflow or share its file, the key stays behind in your n8n, saved in its database and encrypted with your instance’s own encryption key.

Step 6: Find Your Credentials

Every credential you make is listed in one place. Click Overview in the left sidebar, then the Credentials tab:

The Credentials tab of the n8n Overview, listing the credential n8n API (read only) for backups of type n8n API, created 27 November, used by 1 workflow, in Personal.
All your credentials in one list.

The number next to a credential counts the workflows that use it. Click it to see which ones:

The credential card with its count of 1 clicked, opening a list headed Used by workflows that names Back up my workflows.
The workflows that use this credential.

Check this list before you change or delete a credential, because every workflow on it uses the same key. That’s also what makes credentials easy to keep up: when a key expires, you create a new one and paste it into the credential once, and every node that uses it carries on.

You can also create a credential here, before any node needs it. Click Create credential, type the app’s name, choose it and click Continue:

The Add new credential dialog asking Select an app or service to connect to, with n8n API typed in the search and n8n API offered below.
Creating a credential from the Credentials tab.

A credential’s Details tab shows when it was created and its ID. Its Sharing tab says Upgrade to collaborate, because sharing a credential with other users needs a paid plan on self-hosted n8n.

Clean Up

Delete what this part made, in this order, so nothing is left pointing at something that’s gone:

  1. The workflow: open Back up my workflows, click ⋯ next to its name, then Archive. Click ⋯ again, then Delete and Yes, delete.
  2. The credential: on Overview › Credentials, click ⋯ on its card, then Delete and Yes, delete.
  3. The API key: in Settings › n8n API, click ⋯ on its row, then Revoke and Revoke again. Anything still using the key stops working at once, and revoking can’t be undone.

Common Mistakes

MistakeWhat happensDo this instead
Pasting a key into a node’s fieldThe key is saved in plain text in the workflow and travels with every exportPut it in a credential, which n8n keeps encrypted
Giving every key the All scopesA leaked key can change or delete anything on your n8nChoose Read only, or Custom with only what the job needs
Keeping the default name n8n accountWith a few credentials, you can’t tell which is whichName each one after the app, its access and its job
Typing the Base URL without /api/v1The test fails with Couldn’t connect with these settingsType http://localhost:5678/api/v1

Troubleshooting

ProblemCauseFix
Couldn’t connect with these settings and The Base URL does not point to the n8n API. Make sure it includes the API path, for example /api/v1.The Base URL ends without /api/v1Add /api/v1 to the end, then click Retry
Couldn’t connect with these settings and UnauthorizedThe key is wrong, or it was revoked or rotated in Settings › n8n APICreate a new key in Settings › n8n API, paste it into the credential and click Save
The Sharing tab says Upgrade to collaborateSharing credentials with other users needs a paid plan on self-hosted n8nKeep the credential to yourself, or see n8n’s plans

FAQ

Where does n8n keep my credentials?

In its database, encrypted with your instance’s encryption key. n8n makes that key the first time it starts and keeps it in its .n8n folder, which is n8n’s data volume when you run it in Docker. Keep that volume safe: without the key, n8n can’t read your saved credentials.

Can anyone see my key after I save it?

Not in n8n. A saved key shows only as dots, and workflows hold only the credential’s name and ID. That’s why n8n shows a new API key once: copy it before you click Done.

Can I share a credential with my team?

Yes, on n8n Cloud and on the Business and Enterprise plans of self-hosted n8n. The people you share it with can use the credential in their workflows but can’t see or edit its details.

What happens to my workflows if I delete a credential?

Every node that used it stops working until you pick another credential in it. n8n warns you before it deletes one: “This may break any workflows that use it.”

Conclusion

A credential is how n8n remembers the way into an app: you make it once, n8n tests it when you save, keeps it encrypted and lets any node use it. You made one for n8n’s own API with a read-only key, read every workflow with it, and found it again on the Credentials tab. Every app in n8n works the same way: get a key or a sign-in from the app, save it as a credential, and pick it in the node.

← Part 5: Forms: Collect Data with n8n Forms

Coming next: Part 7: Executions, Debugging and Pinned Data.

Additional Resources

n8n and other names mentioned are trademarks of their respective owners. JD Bots isn’t affiliated with or endorsed by n8n GmbH.

0 comments