Matej Mijoski
Matej Mijoski12mo ago

Adding member to organization returns MemberInvalid

I am trying to add a user from organization A to organization B. Organization A has the project which is granted to B along with the custom roles but I am getting a 400 response with Errors.Org.MemberInvalid. The payload is
{
"roles": ["IAM_OWNER"],
"userId": "288662885666652504"
}
{
"roles": ["IAM_OWNER"],
"userId": "288662885666652504"
}
The service user has a manager role on everything and it still doesn't work.
7 Replies
Matej Mijoski
Matej MijoskiOP12mo ago
I am trying to add a user from Organization A to Organization B using a service user which has the manager role on every possible entity. The endpoint is /management/v1/orgs/me/members and the payload is:
{
"roles": ["CLIENT"],
"userId": "288662885666652504"
}
{
"roles": ["CLIENT"],
"userId": "288662885666652504"
}
Org B has been granted the role the project of Org A but I am still getting Errors.Org.MemberInvalid.
fabienne
fabienne12mo ago
It looks like you want to add on organization member but want to add an instance member role in the first screen, an undefined role in the second screen.
fabienne
fabienne12mo ago
with the following request you can get the available roles on organization level: https://zitadel.com/docs/apis/resources/mgmt/management-service-list-org-member-roles
ZITADEL Docs
Members are users with permission to administrate ZITADEL on different levels. This request returns all roles possible for a ZITADEL member on the organization level.
Matej Mijoski
Matej MijoskiOP11mo ago
Sorry, that's a mistake in my post. The correct payload is the 2nd one where I've created the CLIENT role in Organization A and granted the project and role to Organization B but I am still getting Member Invalid.
fabienne
fabienne11mo ago
yes i understand, so in that case you are using the wrong endpoint. memberhsips are for the internal role system of zitadel, with the given roles like IAM_OWNER, ORG_OWNER, etc. you are looking for adding a user grant
Matej Mijoski
Matej MijoskiOP11mo ago
That makes sense, thanks What endpoint would I use to move a user from one organization to another?

Did you find this page helpful?