Hi everyone, I’m running into an issue with the HTTP Request node. I’m trying to call an API using an API key, but I keep getting a 401 Unauthorized response.
My workflow is:
Set → HTTP Request
In the Set node, I store the API key:
{
“api_key”: “123456789”
}
Then in the HTTP Request node, I add it to headers like this:
{
“Authorization”: “Bearer {{$json.api_key}}”
}
But the API keeps returning:
{
“error”: “Unauthorized”
}
Describe the problem/error/question
I’m not sure if:
The header format is wrong
The API expects it in a different place (query/body)
Or n8n is not passing the value correctly
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:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system: