API call from admin to POST /teams/addUser fails due to not being on the team?


We are in a trial right now, I wrote some code to use the API to set team membership for various teams, but when the script runs and tries to add users to certain teams, ones that are “Membership by Request”, I get the error:
“only_team_members_can_add_members”,“message”:“You must be a member of the team to add members”,“user_message”:“You must be a member of the team to add members”
This is strange because I using an API key generated for an admin, and as an admin I can go and add members to a team via the UI. Why doesn’t the REST call let me do it? Is there some setting I am missing somewhere?


Hey @Tim_Fitz, sorry to hear you’re having this issue (and that it has taken a few days to get back to you). The reason you’re getting that error is because you need a Service Account in order to do user administration via the API. Service Accounts are an Enterprise feature, which is generally for customers that need administration and security controls.