How do I create HTTP header auth credentials via API?

I used to create HTTP Header Auth credentials via API up until today. Now it shows errors. The payload I send is:
{
“name”: “Test Creds”,
“type”: “httpHeaderAuth”,
“data”: {
“name”: “Authorization”,
“value”: “testtest”
}
}

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.)

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:

Hi @valonn Welcome!
This is strange, have you created credential schema endpoint before and then built your payload from that?? something like GET /api/v1/credentials/schema/httpHeaderAuth so that you could get the exact data structure it needs for that header auth, maybe then you can try sending that POST request POST /api/v1/credentials with your name on it, and type “httpHeaderAuth” , and so your data object matches this schema, although i think you must be following this so if not let me know how this goes…

POST /api/v1/credentials

{
“name”: “Test Creds”,
“type”: “httpHeaderAuth”,
“data”: {
“json”: { ///////// n8n stores credential values inside the json object /////////////
“name”: “Authorization”,
“value”: “testtest”
}
}
}

Thank you. This helped me solve the issue. I think “allowedHttpRequestDomains” wasn’t required before.

Glad it helped @valonn consider marking that as a solution! Cheers!

Thanks for your reply.

That will help my work in the next time.

Thanks again.