Overview
A project member is a user with a role on a project. The role controls what they can do on that project. To add someone to a project, send them an invite. To learn more, see Project invites.
Listing and getting members need the Read role on the project. Updating and removing members need the Admin role.
To call these endpoints from the CLI, use the lk project member commands, for example lk project member list --user-auth.
Member removal and API keys
Removing a member also revokes the personal API keys they own. Service account and agent keys stay.
Removing a member who owns keys needs your confirmation:
- Remove the member with
confirmedNumKeysset to0. - If the member owns keys, the request returns
400and removes no one. ItsMemberRemovalNotConfirmeddetail in the error response gives the number of keys innumKeys. - Send the request again with
confirmedNumKeysset to that number.
The API also refuses a member removal that leaves a project with no API key. The detail lists the affected projects in lastKeyProjectNames. Generate another key in each of those projects first, such as a service account key.
The project member object
A user's membership on a project.
projectIdstringThe project the membership is on (p_...).
userIdstringThe user who holds the membership.
emailstringThe email address on the user account.
roleint32The role of the user: 0 invited, 1 read, 2 write, 3 admin.
List members
/v0/projects/{projectId}/membersLists the project members, ordered by user ID.
Returns a list of ProjectMember objects, with a pageInfo cursor.
Path parameters
projectIdstringThe project ID (p_...).
Query parameters
page.cursorstringThe cursor of the page to return: the nextCursor of the previous page. When empty, the list starts at the first item.
page.pageSizeint32The maximum number of items to return. When 0, the list uses its default page size.
Get member
/v0/projects/{projectId}/members/{userId}Returns the ProjectMember object.
Path parameters
projectIdstringThe project ID (p_...).
userIdstringThe ID of the user.
Update member
/v0/projects/{projectId}/members/{userId}Returns the ProjectMember object.
Path parameters
projectIdstringThe project ID (p_...).
userIdstringThe ID of the user.
Request body
roleint32Access level to set: 1 read, 2 write, 3 admin.
Remove member
/v0/projects/{projectId}/members/{userId}Path parameters
projectIdstringThe project ID (p_...).
userIdstringThe ID of the user.
Query parameters
confirmedNumKeysintegerThe number of the member's API keys that you agree to delete. Send 0 first. When the member owns API keys, the call fails with FailedPrecondition and a MemberRemovalNotConfirmed detail. Show its numKeys to the user, then send the request again with that number.
Response fields
numKeysintegerThe number of API keys that the removal deleted, not counting agent keys.