Describe the problem/error/question
Hi folks,
how to create credentials referring external secrets and variables via n8n APIs?
I tried with both the n8n node and the http node. Here is the http node example. For the body, I tried to set the following expression:
{
"name": "{{ $('Get row(s) in sheet').item.json['REDIS CREDENTIAL NAME'] }}",
"type": "redis",
"data": {
"password": "{{ $('Get row(s) in sheet').item.json['REDIS CREDENTIAL PASSWORD'] }}",
"user": "{{ $('Get row(s) in sheet').item.json['REDIS CREDENTIAL USERNAME'] }}",
"host": "{{$vars.ENV_n8nRedisInstanceHost}}",
"port": {{$vars.ENV_n8nRedisInstancePort.toNumber()}},
"database": {{$vars.ENV_n8nRedisInstanceDbNum.toNumber()}},
"ssl": true,
"disableTlsVerification": false
},
"isResolvable": false,
"projectId": "{{ $('Create project').item.json.id }}"
}
which produced the following body:
{
"name": "JENG_REDIS",
"type": "redis",
"data": {
"password": "{{ $secrets.n8n.n8n['cwkl-services-aws'].JENG_REDIS_PASS }}",
"user": "{{ $secrets.n8n.n8n['cwkl-services-aws'].JENG_REDIS_USER }}",
"host": "``master.n8n-ai-memory.ca0pia.euc1.cache.amazonaws.com``",
"port": 6379,
"database": 0,
"ssl": true,
"disableTlsVerification": false
},
"isResolvable": false,
"projectId": "4mc5UAoKkScqmwpr"
}
The credential was created successfully, but the external secrets references are set as plain text and not as expressions, see screenshot below.
I want to obtain a credential like the following:
How can I do?
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
- n8n version: 2.39.6
- Database (default: SQLite): PostgreSQL
- n8n EXECUTIONS_PROCESS setting (default: own, main): queue
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: Linux

