I’m trying to connect an external API using the HTTP Request node. I’ve verified the endpoint and API key, but I still receive a 401 Unauthorized error. What should I check next?
Describe the problem/error/question
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.)
@Oluwatobi_Ogunmesin a 401 with a key you know is good is almost always the key going in the wrong spot rather than being wrong. how does the api expect it, a bearer token, a custom header like x-api-key, or a query param? and which auth option did you pick on the http request node? tell me those two and i can point you at the exact setup.
A quick way to debug this while you gather the info @achamm asked for: temporarily swap the auth to “No Auth” and add a header manually under “Headers” - e.g., Authorization: Bearer YOUR_KEY. If that 401 goes away, the issue is in how n8n’s auth fields are mapping the key (wrong prefix, wrong header name). If it stays 401, the key itself or the endpoint is the problem. This isolates credential config vs. API config in one test run.
Hey @Oluwatobi_Ogunmesin, one more thing to check alongside the suggestions made
Watch for extra whitespace in your API key. It’s one of the most common causes of a 401 that “looks right” if you copied the key from a doc or email, there’s often a leading or trailing space that’s invisible in the n8n field but breaks authentication. Retype it manually or paste it into a plain text editor first to strip any hidden characters before pasting into n8n.
Also, some APIs are case-sensitive about the header name itself, Authorization vs authorization vs X-API-Key vs x-api-key. Check the API docs for the exact casing they expect.