Skip to content

Remove employees from a team

POSThttps://gptunnel.ru/api/v1/employees/removeEmployeesFromTeam

Remove one or more employees from a team by login. Identify the team by ID. The API processes each login independently.

The API counts removals in removed, including repeated removal of an existing employee from the team. If no employee with that login belongs to the organization, the login appears in failedLogins.

Request headers

ParameterTypeDescription
Authorization*stringAPI key

Request parameters

ParameterTypeDescription
teamId*stringTeam ID
logins*string[]Array of 1 to 25 employee logins.

Error reasons in failedLogins:

Error reasons

ParameterTypeDescription
not_foundstringNo employee in the organization has this login
forbiddenstringYou cannot manage an employee with a higher role than yours or manage your own account
errorstringUnforeseen processing error

Set GPTUNNEL_API_KEY and replace the placeholders with values for your organization.

import json
import os
from urllib.request import Request, urlopen
key = os.environ.get("GPTUNNEL_API_KEY")
if not key:
raise SystemExit("Set GPTUNNEL_API_KEY")
body = {
"teamId": "66a346f64dcb57627c03d596",
"logins": [
"ivanov",
"petrov"
]
}
request = Request(
"https://gptunnel.ru/api/v1/employees/removeEmployeesFromTeam",
method="POST",
headers={
"Authorization": key,
"Content-Type": "application/json",
},
data=json.dumps(body).encode("utf-8"),
)
with urlopen(request, timeout=30) as response:
print(json.load(response))
{
"code": 0,
"teamId": "66a346f64dcb57627c03d596",
"removed": 2,
"failed": 0,
"failedLogins": []
}