I have a Webhook node that accepts POST requests, retrieves an access token from the request headers, and then connects to an AI Agent. The AI Agent has an OpenAI node and the MCP tool client.
The MCP tool’s authentication is configured to use an n8n Header Auth credential with the following expression to fetch the value:
Is it guaranteed that the credential will be evaluated for each workflow execution using the corresponding execution data? Or is it possible that the evaluated result would be reused?
From my tests, it appears to be evaluated for each workflow execution.
I couldn’t find any documentation that confirms this.
Could someone help confirm whether this is intended behavior and whether there is no credential reuse between workflow executions? Many thanks!
Thanks, @Anshul_Namdev. Is there some official documentation around this?
I couldn’t find any. The closest I could see was about expression, which says about “dynamic” evaluation Expressions | n8n Docs . It would be great if its usage with credentials is documented, thanks!
Yes @Ajith_Chandran , n8n does evaluate credential expressions at run time using the current execution’s data (that’s why your webhook header expression works). People use this to make things like API keys dynamic in credentials.
However, n8n still does not support fully switching between completely different saved credentials at runtime (the node still points to a specific credential object). That’s a known limitation and often requires workarounds like multiple branches or managing credential selection outside a single node.
So in short:
The expression in your credential value is evaluated separately for each workflow run.
n8n does not reuse the evaluated value across runs.
But you cannot dynamically choose a different saved credential entirely via expression in a single node.
Your observed behavior matches how expressions and credentials are currently designed in n8n. If you want truly runtime-swappable credentials, you’ll need a pattern like a switch node or managing credential updates via the API.
Thanks, @Anshul_Namdev, your response kind of helps. But I’m still interested in knowing whether there is any additional documentation / official info to substantiate the mentioned behavior, so as to ensure the behavior won’t change in future releases.