Header Auth Account - Perplexity AI API

I am trying to execute a workflow that incorporates the use of PerplexityAI API. I have have created the relevant credentials but keep getting the following error " Header name must be a valid HTTP token [“Header Auth account”]"

And here is a more detailed breakdown of the error message :frowning:

{
“errorMessage”: “Header name must be a valid HTTP token ["Header Auth account"]”,
“errorDetails”: {
“rawErrorMessage”: [
“Header name must be a valid HTTP token ["Header Auth account"]”
],
“httpCode”: “ERR_INVALID_HTTP_TOKEN”
},
“n8nDetails”: {
“nodeName”: “PerplexityAI API”,
“nodeType”: “n8n-nodes-base.httpRequest”,
“nodeVersion”: 4.2,
“itemIndex”: 0,
“time”: “12/03/2025, 15:16:25”,
“n8nVersion”: “1.81.4 (Cloud)”,
“binaryDataMode”: “filesystem”,
“stackTrace”: [
“NodeApiError: Header name must be a valid HTTP token ["Header Auth account"]”,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js:525:33)“,
" at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:660:19)”,
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:891:51",
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/execution-engine/workflow-execute.js:1224:20"
]
}
}

When i create the credentials i pasted the API Key into the value section.

Without leaking private info, could you show me how you setup the header auth for the connection?

The header auth should look like:
Authorization: Bearer {API_KEY}, where Authorization is the key, and Bearer {API_KEY} is the value.

Apologies, I am new to this and learning - Where would i find the The header auth? Is where i set up the credentials?

@ThinkBot - See below

I use the following in the value : Bearer {API KEY}

But this error keeps appearing

The name field… its supposed to be “Authorization” not the name of the connection.

Thanks @ThinkBot - That seems to have worked but now a new issue has appeared and its clearly to do with the API key from Perplexity. But i cant see how it can be wrong when i am physically getting it from the site?

Can you show me the value of the credential? (remove half of key or blur it) Want to make sure that is right as well. The key value should be like:

Bearer sk-999999999
(example)

not Bearer {sk-999999}. Just in case you did that.

2 Likes

That worked - Thanks @ThinkBot

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.