Skip to content

Add employees to a team

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

Adds employees to the team identified by its ID. The API processes each employee login independently. Employees can belong to multiple teams. Adding someone to a team preserves their membership in other teams.

If an employee already belongs to the team, the API still counts that login in added. An unknown team ID returns HTTP 404 before any logins are processed.

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/addEmployeesToTeam",
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",
"added": 1,
"failed": 1,
"failedLogins": [
{
"login": "petrov",
"reason": "not_found",
"message": "Employee not found in the organization."
}
]
}