N8N API - Creating credentials in a project

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:

the HTTP node:

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

1 Like

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

See also this thread: Creating Credentials using API

1 Like

thank you for the quick response.

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.

1 Like

@marceldw agreeing with you on this one. There should be a way to handle credentials per project to have scalable enterprise grade solutions.

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