Skip to content

Employee access settings

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

Set individual access settings for employees. Send up to 25 { login, settings } entries. If a login appears more than once, only its first entry is applied. An error for one employee does not stop the request from processing the others.

Include at least one of the five fields in settings. Omit fields that should keep their current values.

Settings fields

ParameterTypeDescription
showBalancestringShow the employee their balance
webSearchstringWeb search
imageGenerationstringImage Generation
thinkingModestringReasoning mode
useOrgBalancestringAllow spending from the organization balance

Each setting accepts one of the following values.

Values

ParameterTypeDescription
allowstringAllow this feature for the employee
forbidstringBlock this feature for the employee
defaultstringReset to default value (delete personal settings)

The API checks the key creator’s current role:

  • The creator must be an owner, admin, or manager. Otherwise the entire request returns HTTP 403.
  • Owners and admins can update other employees whose role is equal to or below their own. Trying to update their own account or someone with a higher role returns forbidden for that login.
  • Managers can update only members of their own teams. They can tighten restrictions. Allowing a feature blocked by the organization returns forbidden for that login. Managers cannot change showBalance or useOrgBalance.

Request headers

ParameterTypeDescription
Authorization*stringAPI key

Request parameters

ParameterTypeDescription
items*object[]Array of 1–25 items. Each item contains { login, settings }.
items[].login*stringEmployee login
items[].settings*objectSupply at least one setting with a value of allow, forbid, or default.

The response counts successful updates in updated and failures in failed. Each entry in failedLogins identifies the login and explains the error.

Error reasons in failedLogins:

Error reasons

ParameterTypeDescription
not_foundstringNo employee in the organization has this login
forbiddenstringThe employee has a higher role or is the key creator. For a manager, the employee is not a member of their teams or the change weakens the organization’s restrictions.
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 = {
"items": [
{
"login": "ivanov",
"settings": {
"webSearch": "forbid",
"imageGeneration": "allow",
"showBalance": "default"
}
},
{
"login": "petrov",
"settings": {
"useOrgBalance": "forbid"
}
}
]
}
request = Request(
"https://gptunnel.ru/api/v1/access/setRestrictions",
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,
"updated": 1,
"failed": 1,
"failedLogins": [
{
"login": "petrov",
"reason": "not_found",
"message": "Employee not found in the organization."
}
]
}