Auto Creating Credentials (unknown error)

So, I’ve been trying to create credentials through the n8n API … I’ve been following the same payload structure as here : API reference - n8n Documentation

It’s giving me an 'unknown error ’ 400 … On the other had I am able to read the API and return info (for example about workflows) … I’m also able to create workflows through the API … However the creation of credentials is giving me this:

Anyone have any idea ?

Hey @lexgabrees,

Which credential type are you trying to create? The doc example on that page is wrong and the credential type is actually githubApi

That might be the reason … I’m trying to create a header auth … can’t find a list of types though … or maybe I just didn’t look well …

Edit:

No luck … I tested and tried, but still getting the same error

Hey @lexgabrees,

Give the workflow below a go, The credential type is the name of the credential. You can find the HTTP Header Auth name here: n8n/HttpHeaderAuth.credentials.ts at master · n8n-io/n8n · GitHub

1 Like

Thanks for the help … I got it to work … but only with the n8n node, and not with the httprequest … With the n8n node it worked on the first try :

  1. Get the schame (expected Json object)
  2. Feed it to the node and let it create the credential …

Still, wondering why I couldn’t get it to work with the httprequest node …

Hey @Jon

I am currently facing a similar issue. Initially, I attempted to create FTP credential using the HTTP node through the n8n API, but encountered a “Bad Request” error. Now I’m trying with the n8n node, but still getting the same error. Any ideas on what might be causing this issue?



Hey @mixuci,

The port should be a number so rather than "port": "21" it would need to be "port": 21, Example below.