Using custom credentials as variables in URL

Describe the problem/error/question

I’m trying to integrate n8n with Bitrix24. Both run on-prem. I was able to create HTTP request simply by importing curl. Bitrix requires USER_ID and SECRET_KEY in the URL:

curl -X POST "https://company.com/rest/USER_ID/SECRET_KEY//crm.deal.list" \
     -H "Content-Type: application/json" \
     -d '{
           "order": { "DATE_CREATE": "DESC" },
           "filter": { ">PROBABILITY": 1 },
           "select": [ "ID", "TITLE", "STAGE_ID" ]
         }'

Is there a way to keep USER_ID and SECRET_KEY as custom credentials (or any other type) and pass them as variables using js expression?

What is the error message (if any)?

Please share your workflow

I swapped the real id and secret key with USER_ID and SECRET_KEY

Share the output returned by the last node

not relevant

Information on your n8n setup

  • **n8n version: 1.98.2
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: ubuntu server 24

If you have the Enterprise license I believe you can use global secrets, but the way Ive done this is to use environment variables on the host. Since you’re using docker you could also use docker secrets and access it as an env var using either {{ process.env.USER_ID }} or {{ $env.USER_ID }}. This way it is not quite hard coded in n8n.

I don’t have enterprise license and I don’t want to use docker env var, as I want to allow users to configure it from webUI for their workflows.

In that case you’ll need to add a database and store the values in a table.