Credentials Overview¶
Securely store and manage authentication credentials for nodes.
What are Credentials?¶
Credentials store sensitive authentication data:
- API keys
- OAuth tokens
- Database passwords
- Service account keys
Security Features¶
| Feature | Description |
|---|---|
| AES-256 encryption | Credentials encrypted at rest |
| Access control | Per-workflow credential access |
| Audit logging | Track credential usage |
| Secure storage | Never exposed in logs or API |
Credential Structure¶
{
"id": "cred-123",
"name": "My API Key",
"type": "apiKey",
"data": {
"apiKey": "encrypted..."
},
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z"
}
Creating Credentials¶
Via CLI¶
Via API¶
curl -X POST http://localhost:8080/api/v1/credentials \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "My API Key",
"type": "apiKey",
"data": {
"apiKey": "sk-xxx..."
}
}'
Using Credentials¶
In Workflow JSON¶
Reference credentials by ID or name:
{
"nodes": [
{
"type": "n8n-nodes-base.httpRequest",
"parameters": {
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "cred-123",
"name": "My API Key"
}
}
}
]
}
In Expressions¶
Access credential data:
Managing Credentials¶
List Credentials¶
Get Credential¶
Update Credential¶
Delete Credential¶
Best Practices¶
1. Use Descriptive Names¶
2. Rotate Regularly¶
- Set up credential rotation schedules
- Update workflows after rotation
- Monitor for failures after rotation
3. Limit Scope¶
- Grant minimal permissions
- Use separate credentials per environment
- Avoid shared credentials across workflows
4. Audit Access¶
Environment Variables¶
For local development, use environment variables:
Access in expressions:
Encryption¶
Configuration¶
Set encryption key:
Or via environment:
Key Management¶
- Use strong, random 32-byte keys
- Store keys securely (vault, KMS)
- Rotate keys periodically
Credential Types¶
See Credential Types for all supported types:
- API Key
- OAuth2
- Basic Auth
- HTTP Header
- Database connections
- Cloud provider credentials
Next Steps¶
- Credential Types - All credential types
- API Reference - Credential API endpoints