Using API to retrieve the members of a Project and their current "role" within that project

Describe the problem/error/question

Good afternoon! I’m working on automating Active Directory group synchronization with n8n projects, and I’ve hit a roadblock with the public API.

What I’m trying to accomplish: I want to automatically sync Active Directory groups with n8n project memberships. To do this properly, I need to:

  1. Get the current list of users in each project

  2. Get each user’s role/permission level in that project

  3. Compare with AD groups to determine if I need to add, remove, or update users to projects

What I’ve found so far: The n8n API documentation shows how to:

  • :white_check_mark: Add a user to a project (POST /api/v1/projects/{projectId}/users)

  • :white_check_mark: Remove a user from a project (DELETE api/v1/projects/{projectId}/users/{userId})

  • :white_check_mark: Update a user’s role in a project (PATCH api/v1/projects/{projectId}/users/{userId})

What seems to be missing:

  • :cross_mark: Get a list of users in a project with their roles (GET /api/v1/projects/{projectId}/users returns 405 Method Not Allowed)

  • :cross_mark: Get user-project relationships through any other endpoint

What I’ve tried:

  • GET /api/v1/projects/{projectId} - Returns basic project info (id, name, type) but no user data

  • GET /api/v1/projects/{projectId}/users - Returns 405 Method Not Allowed

  • GET /api/v1/projects/{projectId}/relations - Returns 404 Not Found

  • GET /api/v1/users - Returns all users but without project associations

What I’ve observed: I can see in the browser’s network tab that the n8n UI successfully retrieves project members through REST endpoints, but when I try to access these same endpoints using an API key, I get permission errors or method not allowed responses.

My question: Is there a way to retrieve the current list of users and their roles for a specific project using the public API with an API key? Or is this functionality only available through the UI’s internal REST interface?

This is the last missing piece for a fully automated AD → n8n synchronization solution. Without the ability to read current project memberships, I can’t determine whether users need to be added, removed, or have their roles updated.

Any guidance would be greatly appreciated!

Information on your n8n setup

  • n8n version: 1.118.2
  • Database (default: SQLite): PostgreSQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main): ???
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Kubernetes (AKS)
  • Operating system: Community HELM

Hey @David_Hoffman Welcome to the community.

Unfortunately, there isn’t an official API to get the data you need.

The workaround however as you’ve correctly assumed is through the frontend apis. Auth can be achieved by using a valid session cookie so pretty insecure and breaks when the cookie expires so I don’t recommend it as a long term solution.

You’ll need to dive into developer tools to get two pieces of info

  • Cookie value for n8n-auth
  • header value for Browser-Id

I face the same challenge while trying to integrate SailPoint ISC with n8n using the Web Services API. Are there any plans to add a native node for this?

We can list accounts and roles, list project, but no way to find project members.

@mariana-na Can you shed some light on this? Also, are you aware of any other method to list project members?

King Regards!

1 Like

Hi David, how are you today? Did you found a solution? Regards!

Actually yes….

It is a bit hidden in the docs, but here is the API to do it…

You can run that API and pass the projectID and it will give you all the users in that project.

2 Likes

@David_Hoffman Thank you. Were you able to identify their role within the project? (e.g., project admin, viewer, or editor?)"

Unfortunately no.. It only returns the user object not the users role within the project.

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