Skip to content

Enable employee accounts

POSThttps://gptunnel.ru/api/v1/access/enableAccounts

Re-enable one or more employee accounts by login. This reverses disabling an account. Enabled employees can sign in and work in the organization again. Each login is processed independently. A failure for one login does not stop the rest.

Request headers

ParameterTypeDescription
Authorization*stringAPI key

Request parameters

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

The response reports the number of enabled accounts in enabled and the number of failed items in failed. Each entry in failedLogins identifies the login and explains why it failed.

Error reasons in failedLogins:

Error reasons

ParameterTypeDescription
not_foundstringNo employee in the organization has this login
forbiddenstringYou can't include an account with a higher role, your own account or an account not created by this organization
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/access/enableAccounts",
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,
"enabled": 1,
"failed": 1,
"failedLogins": [
{
"login": "petrov",
"reason": "not_found",
"message": "Employee not found in the organization."
}
]
}