Now inviting automation leaders: publish your playbook as a skill, under your own name. Publish yours →
Automation Skills
All skills/n8n credentials and security official/CREDENTIAL_SYSTEM
Reference · n8n credentials and security official

CREDENTIAL_SYSTEM

Part of n8n credentials and security official. Install the skill and your agent reads this page when it needs the depth.

How the credential system works

Credentials in n8n are first-class, encrypted, referenced-by-ID objects.

Storage model

The key property: workflow JSON can be safely shared (Git, chat, screenshots) without leaking secrets, as long as you used the credential system instead of pasting values into text fields.

Reference shape

In the workflow JSON, a node that uses credentials has a parameter shaped like:

{
  "credentials": {
    "<credentialType>": {
      "id": "abc123",
      "name": "Acme API (prod)"
    }
  }
}

Both are exported. Neither is sensitive, and knowing the ID does not let an attacker authenticate.

In SDK code

When writing workflow SDK code, reference credentials via newCredential():

const slack = node({
  type: 'n8n-nodes-base.slack',
  config: {
    parameters: { /* ...other params... */ },
    credentials: { slackApi: newCredential('Slack') },
  },
})

The shape that matters:

The recommended flow:

  1. Call list_credentials({type}) to discover what exists.
  2. If exactly one matches, bind by ID. Two paths:
    • At create time: newCredential('Label', 'credId'). The 2-arg form serializes to { id, name } and hard-binds.
    • Post-create: setNodeCredential op on update_workflow:
      { type: 'setNodeCredential', nodeName: 'Send Slack',
        credentialKey: 'slackApi', credentialId: 'abc123', credentialName: 'Slack prod' }
      
  3. If multiple match, ask the user which.
  4. If none, the user creates one in the UI (credential creation is still UI-only), then re-call list_credentials.

Project scoping

On n8n Cloud and self-hosted with project support:

When the user mentions "the prod credential," confirm the project. If multiple projects have similar names, ask before guessing.

Rotation

When a secret value rotates:

If the user says "I rotated the API key, why is the workflow still failing?", confirm they updated the credential in n8n (not just rotated upstream). Both sides need to match.

Discovery

Use list_credentials({type, query, projectId, ...}) to discover credentials. Returns name, type, scopes, project (never secret values). Pair with setNodeCredential to bind.

Publish your skill

Copy this prompt into Claude Code, Codex or any agent. It walks you through your first skill in about 20 minutes, with you as the author.

Click to copy.