Skip to content

Delete employee accounts

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

Removes one or more employees from the organization by login. An error for one employee does not stop the request from processing the others.

Request headers

ParameterTypeDescription
Authorization*stringAPI key

Request parameters

ParameterTypeDescription
logins*string[]Array of 1 to 25 employee logins. Send a one-item array to remove one employee.

The response contains deleted (number of removed employees), failed (number of failed items), and failedLogins (reason and explanation for each failure).

Error reasons in failedLogins:

Error reasons

ParameterTypeDescription
not_foundstringNo employee in the organization has this login
forbiddenstringYou can't remove an employee with a bigger role than yours, or your own account
errorstringAn unexpected error occurred while processing this employee

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 = {
"logins": [
"ivanov",
"petrov"
]
}
request = Request(
"https://gptunnel.ru/api/v1/employees/deleteEmployees",
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,
"deleted": 1,
"failed": 1,
"failedLogins": [
{
"login": "petrov",
"reason": "not_found",
"message": "Employee not found in the organization."
}
]
}