Hey all,
I want to programmatically create credentials inside a project. However, I do not know how to correctly trigger the API to not create the credential in the personal space, but in the project itself:
This is the body and everything is working, but the credential is created in the personal space:
I already tried different URLs like ../api/v1/projects/projectid/credentials or used the project id in the header with: X-N8N-PROJECT-ID or X-N8N-Workspace-ID
Does somebody know? I also cannot find it in the documentation
@marceldw
You can create credentials via the n8n REST API using POST /api/v1/credentials, but these will always end up in your personal space.
There’s currently no API support for specifying a project context, using project-related URLs or headers has no effect.
To get credentials into a project, you must either move them manually in the UI.
Use the API to create the credential (it ends up in your personal space). Then, in the web UI, manually move or copy it into the desired project.
To be honest in the current state with no possibility to get credentials or create them in projects and also use them dynamically in nodes the whole authentication is very limited and restrictive to the point that we have no choice but to manage the authentication on our own.
I get the security concerns but there needs to be a better way to handle this, most scalable solutions are not possible with the current setup.