Skip to content

Set team model access

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

Allow or block specific models for teams. Send up to 25 { teamId, models } entries. Each entry is processed independently. If a team ID repeats, only its first entry is used.

To find a teamId as an owner, admin, or manager, see read team settings. Get each model ID from GET /v1/models. Set permission to allow, forbid, or default to allow access, block it, or remove the team override.

Request headers

ParameterTypeDescription
Authorization*stringAPI key

Request parameters

ParameterTypeDescription
items*object[]Array of 1 to 25 entries. Each contains { teamId, models }.
items[].teamId*stringTeam ID from POST /api/v1/employees/getTeams.
items[].models*object[]List of 1–100 { model, permission } pairs. permission must be allow, forbid, or default.

The response counts successful updates in updated and failures in failed. Each entry in failedTeams identifies the team and explains the failure. For model_not_found, unknownModels lists the unknown model IDs. No changes are applied to that team.

Error reasons in failedTeams:

Error reasons

ParameterTypeDescription
not_foundstringNo team in the organization has this ID
model_not_foundstringunknownModels lists the unrecognized model IDs. No changes were applied to the team.
forbiddenstringThe team is outside the manager’s scope or the change weakens the organization’s restrictions.
errorstringUnexpected error processing this team

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": [
{
"teamId": "664f0a1b2c3d4e5f60718293",
"models": [
{
"model": "claude-5.5-haiku",
"permission": "forbid"
},
{
"model": "gpt-6-luna",
"permission": "allow"
}
]
}
]
}
request = Request(
"https://gptunnel.ru/api/v1/access/setTeamModelAccess",
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": 0,
"failedTeams": []
}