# Read access settings

Source: [Read access settings](<https://docs.gptunnel.ru/en/access/read-settings/>)

<a id="_top"></a>
> **Note: Organization API key**
>
> Use an API key for your organization with the Full dashboard access permission. See the roles and restrictions below. [Get an API key](<https://docs.gptunnel.ru/en/>).

Each method returns settings explicitly set at the requested level (employee, team, or organization). For example, a model can have permission `default` for an employee and `forbid` for the organization. The most restrictive setting across all levels takes effect.

<a id="who-can-read-settings"></a>
## Who can read settings?

- An **owner** or **admin** can read settings for any employee, any team, and the organization.
- A **manager** can read their own settings, their teams’ settings, the settings of members of those teams, and the organization’s settings. A team or employee outside their scope returns `forbidden`.
- A key whose creator has the member role, or a personal account key, receives HTTP `403` for the whole request.

Reading settings leaves them unchanged and creates no entry in the organization’s audit log.

<a id="settings-format"></a>
## Settings Format

### Selected level settings

| Parameter | Type | Description |
| --- | --- | --- |
| `settings` (required) | `object` | For showBalance, webSearch, imageGeneration, thinkingMode, and useOrgBalance, the accepted values are allow, forbid, and default |
| `globalLimit` (required) | `object` | {dailyLimit, monthlyLimit} is the total limit for all models, rubles; 0 = no limit |
| `inflight` (required) | `object` | { inflightCountLimit, inflightRubLimit, maxCostLimit } sets concurrent generation limits. Use 0 for no limit |
| `models` (required) | `object[]` | Models with settings at this level: { model, permission, dailyLimit, monthlyLimit, paramRules } |
| `models[].paramRules` (required) | `object \| null` | Limitations on model parameters in rules format (see "Restrictions by parameters"); null - not specified |

To update a setting, copy the relevant fields into the body of the update request. For example, pass the login and `settings.globalLimit.dailyLimit` as `items[0].login` and `items[0].dailyLimit` to [update the overall spending limit](<https://docs.gptunnel.ru/en/access/global-limit/>). Omit `monthlyLimit` to keep the current monthly limit. Updates accept whole rubles. If the current limit is fractional, supply a new whole number only when you intend to change it.

<a id="staff"></a>
## Staff

`POST https://gptunnel.ru/api/v1/access/getSettings`

### Request parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `logins` (required) | `string[]` | Array of 1 to 25 employee logins. Matching is case-insensitive. |

The response lists matching employees in `items` as `{ login, settings }`. Failures appear in `failed` and `failedLogins` with the reason `not_found` (outside the organization), `forbidden` (outside the manager’s teams), or `error`.

Set `GPTUNNEL_API_KEY` and replace the placeholders with values for your organization.

<a id="tab-panel-0-0"></a>
**Python**

```python
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@company.com",
    "nobody@company.com"
  ]
}
request = Request(
    "https://gptunnel.ru/api/v1/access/getSettings",
    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))
```

<a id="tab-panel-0-1"></a>
**cURL**

```bash
curl --request POST \
  --url 'https://gptunnel.ru/api/v1/access/getSettings' \
  --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{
  "logins": [
    "ivanov@company.com",
    "nobody@company.com"
  ]
}'
```

<a id="tab-panel-0-2"></a>
**JavaScript (Node.js)**

```javascript
const key = process.env.GPTUNNEL_API_KEY
if (!key) throw new Error("Set GPTUNNEL_API_KEY")

const body = {
  "logins": [
    "ivanov@company.com",
    "nobody@company.com"
  ]
}
const response = await fetch("https://gptunnel.ru/api/v1/access/getSettings", {
  method: "POST",
  headers: {
    Authorization: key,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(body),
})
if (!response.ok) throw new Error(await response.text())
console.log(await response.json())
```

```json
{
  "code": 0,
  "items": [
    {
      "login": "ivanov@company.com",
      "settings": {
        "settings": {
          "showBalance": "default",
          "webSearch": "forbid",
          "imageGeneration": "default",
          "thinkingMode": "default",
          "useOrgBalance": "default"
        },
        "globalLimit": { "dailyLimit": 0, "monthlyLimit": 5000 },
        "inflight": { "inflightCountLimit": 2, "inflightRubLimit": 500, "maxCostLimit": 150 },
        "models": [
          {
            "model": "seedance-2-5",
            "permission": "default",
            "dailyLimit": 0,
            "monthlyLimit": 0,
            "paramRules": {
              "by": "resolution",
              "any": { "max": { "duration": 5 } },
              "values": { "480p": { "deny": true } }
            }
          }
        ]
      }
    }
  ],
  "failed": 1,
  "failedLogins": [
    {
      "login": "nobody@company.com",
      "reason": "not_found",
      "message": "Employee not found in the organization."
    }
  ]
}
```

 <a id="commands"></a>
 
<a id="teams"></a>
## Teams

`POST https://gptunnel.ru/api/v1/access/getTeamSettings`

Pass 1 to 25 team IDs in `teamIds`. An owner or admin with permission to manage employees can get the IDs from the [team list](<https://docs.gptunnel.ru/en/employees/teams-list/>). In the business dashboard, a manager can open **Analytics → Teams**, open the menu for their team, and select **Copy ID** to copy its `teamId`. An admin can also share the ID.

Each entry in `items` contains `{ teamId, settings }`. Failures appear in `failed` and `failedTeams` with the reason `not_found`, `forbidden` (the team is outside the manager’s scope), or `error`.

<a id="tab-panel-1-0"></a>
**Python**

```python
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 = {
  "teamIds": [
    "664f0a1b2c3d4e5f60718293"
  ]
}
request = Request(
    "https://gptunnel.ru/api/v1/access/getTeamSettings",
    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))
```

<a id="tab-panel-1-1"></a>
**cURL**

```bash
curl --request POST \
  --url 'https://gptunnel.ru/api/v1/access/getTeamSettings' \
  --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{
  "teamIds": [
    "664f0a1b2c3d4e5f60718293"
  ]
}'
```

<a id="tab-panel-1-2"></a>
**JavaScript (Node.js)**

```javascript
const key = process.env.GPTUNNEL_API_KEY
if (!key) throw new Error("Set GPTUNNEL_API_KEY")

const body = {
  "teamIds": [
    "664f0a1b2c3d4e5f60718293"
  ]
}
const response = await fetch("https://gptunnel.ru/api/v1/access/getTeamSettings", {
  method: "POST",
  headers: {
    Authorization: key,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(body),
})
if (!response.ok) throw new Error(await response.text())
console.log(await response.json())
```

<a id="organization"></a>
## Organization

`POST https://gptunnel.ru/api/v1/access/getOrgSettings`

This method takes no parameters. Send an empty JSON object `{}`. The response is `{ "code": 0, "settings": { ... } }` in the format above.

<a id="tab-panel-2-0"></a>
**Python**

```python
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 = {}
request = Request(
    "https://gptunnel.ru/api/v1/access/getOrgSettings",
    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))
```

<a id="tab-panel-2-1"></a>
**cURL**

```bash
curl --request POST \
  --url 'https://gptunnel.ru/api/v1/access/getOrgSettings' \
  --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{}'
```

<a id="tab-panel-2-2"></a>
**JavaScript (Node.js)**

```javascript
const key = process.env.GPTUNNEL_API_KEY
if (!key) throw new Error("Set GPTUNNEL_API_KEY")

const body = {}
const response = await fetch("https://gptunnel.ru/api/v1/access/getOrgSettings", {
  method: "POST",
  headers: {
    Authorization: key,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(body),
})
if (!response.ok) throw new Error(await response.text())
console.log(await response.json())
```

```json
{
  "code": 0,
  "settings": {
    "settings": {
      "showBalance": "default",
      "webSearch": "default",
      "imageGeneration": "default",
      "thinkingMode": "forbid",
      "useOrgBalance": "default"
    },
    "globalLimit": { "dailyLimit": 0, "monthlyLimit": 100000 },
    "inflight": { "inflightCountLimit": 0, "inflightRubLimit": 0, "maxCostLimit": 5000 },
    "models": [
      { "model": "gpt-6-luna", "permission": "forbid", "dailyLimit": 0, "monthlyLimit": 0, "paramRules": null }
    ]
  }
}
```

<a id="tab-panel-3-0"></a>
**403 Forbidden**

```json
{
  "code": 7,
  "message": "Not allowed to perform this action for the organization."
}
```

<a id="tab-panel-3-1"></a>
**401 Unauthorized**

```json
{
  "error": {
    "message": "Unauthorized",
    "type": "unauthorized_request_error",
    "param": null,
    "code": null
  }
}
```
