# Organization settings

Source: [Organization settings](<https://docs.gptunnel.ru/en/access/org-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/>).

In the dashboard, open **Access → Organization settings**. These settings apply to all employees and teams, alongside any settings at those levels. The methods below are the organization-wide counterparts of the [employee](<https://docs.gptunnel.ru/en/access/settings/>) and [team](<https://docs.gptunnel.ru/en/access/team-settings/>) methods. The key identifies the organization, so there is no list of employees or teams to pass.

See [concurrent generation limits](<https://docs.gptunnel.ru/en/access/inflight/#organizations>) and [model parameter rules](<https://docs.gptunnel.ru/en/access/param-rules/#organizations>) for the organization-wide limits on generation.

<a id="who-can-make-changes"></a>
## Who can make changes

Only a key whose creator is an **owner** or **admin** can change these settings. A **manager** can update their own teams and team members. An organization-level request with a manager’s key returns HTTP `403` and code `7`. Personal account keys and keys whose creator has the member role receive HTTP `403` for the entire request.

<a id="responses"></a>
## Responses

A successful request returns `{ "code": 0, "updated": true }`. The following errors apply to the entire request.

### Errors

| Parameter | Type | Description |
| --- | --- | --- |
| `400 (code 3)` | `error` | Incorrect entry; for unknown model - details\[0\].code = model\_not\_found and unknownModels, nothing applied |
| `403 (code 7)` | `error` | A key with the manager or member role. |
| `403 (code 13 / 30)` | `error` | Personal account key/key without permission Full dashboard access |
| `500 (code 1)` | `error` | Unforeseen Error — Repeat Request |

<a id="feature-switches"></a>
## Feature switches

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

Supply at least one of the [employee settings](<https://docs.gptunnel.ru/en/access/settings/>) fields: `showBalance`, `webSearch`, `imageGeneration`, `thinkingMode`, or `useOrgBalance`. Each accepts `allow`, `forbid`, or `default`. Omitted settings keep their current values.

### Request parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `settings` (required) | `object` | Feature switches: { showBalance?, webSearch?, imageGeneration?, thinkingMode?, useOrgBalance? }. Each accepts allow, forbid, or default. |

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 = {
  "settings": {
    "thinkingMode": "forbid",
    "showBalance": "allow"
  }
}
request = Request(
    "https://gptunnel.ru/api/v1/access/setOrgRestrictions",
    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/setOrgRestrictions' \
  --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{
  "settings": {
    "thinkingMode": "forbid",
    "showBalance": "allow"
  }
}'
```

<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 = {
  "settings": {
    "thinkingMode": "forbid",
    "showBalance": "allow"
  }
}
const response = await fetch("https://gptunnel.ru/api/v1/access/setOrgRestrictions", {
  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,
  "updated": true
}
```

<a id="access-to-models"></a>
## Access to models

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

To set organization-wide model access, send 1 to 100 `{ model, permission }` entries. Each `permission` accepts `allow`, `forbid`, or `default`. If any model ID is unknown, none of the changes are applied.

### Request parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `models` (required) | `object[]` | Array of 1–100 { model, permission } objects. Use a model ID from GET /v1/models. |

<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 = {
  "models": [
    {
      "model": "gpt-6-luna",
      "permission": "forbid"
    }
  ]
}
request = Request(
    "https://gptunnel.ru/api/v1/access/setOrgModelAccess",
    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/setOrgModelAccess' \
  --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{
  "models": [
    {
      "model": "gpt-6-luna",
      "permission": "forbid"
    }
  ]
}'
```

<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 = {
  "models": [
    {
      "model": "gpt-6-luna",
      "permission": "forbid"
    }
  ]
}
const response = await fetch("https://gptunnel.ru/api/v1/access/setOrgModelAccess", {
  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="tab-panel-2-0"></a>
**200 OK**

```json
{
  "code": 0,
  "updated": true
}
```

<a id="tab-panel-2-1"></a>
**400 Unknown model**

```json
{
  "code": 3,
  "message": "Invalid input, check schema issues.",
  "details": [
    {
      "code": "model_not_found",
      "message": "Unknown model id(s) — see unknownModels. Nothing was applied. Use ids returned by GET /v1/models.",
      "unknownModels": ["no-such-model"]
    }
  ]
}
```

<a id="model-limits"></a>
## Model limits

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

Set daily or monthly spending limits in whole rubles per model across the organization. Send 1 to 100 `{ model, dailyLimit?, monthlyLimit? }` entries. Use `0` for no limit. Only the supplied fields are updated.

<a id="tab-panel-3-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 = {
  "models": [
    {
      "model": "claude-5.5-haiku",
      "dailyLimit": 1000
    }
  ]
}
request = Request(
    "https://gptunnel.ru/api/v1/access/setOrgModelLimits",
    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-3-1"></a>
**cURL**

```bash
curl --request POST \
  --url 'https://gptunnel.ru/api/v1/access/setOrgModelLimits' \
  --header "Authorization: ${GPTUNNEL_API_KEY:?Set GPTUNNEL_API_KEY}" \
  --header 'Content-Type: application/json' \
  --data '{
  "models": [
    {
      "model": "claude-5.5-haiku",
      "dailyLimit": 1000
    }
  ]
}'
```

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

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

const body = {
  "models": [
    {
      "model": "claude-5.5-haiku",
      "dailyLimit": 1000
    }
  ]
}
const response = await fetch("https://gptunnel.ru/api/v1/access/setOrgModelLimits", {
  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="total-limit"></a>
## Total limit

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

Set the organization’s total daily or monthly spending limit across all models. Pass at least one field in `{ dailyLimit?, monthlyLimit? }`. Values are in whole rubles. Use `0` for no limit.

<a id="tab-panel-4-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 = {
  "monthlyLimit": 100000
}
request = Request(
    "https://gptunnel.ru/api/v1/access/setOrgGlobalLimit",
    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-4-1"></a>
**cURL**

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

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

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

const body = {
  "monthlyLimit": 100000
}
const response = await fetch("https://gptunnel.ru/api/v1/access/setOrgGlobalLimit", {
  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,
  "updated": true
}
```

Current values return [`getOrgSettings`](<https://docs.gptunnel.ru/en/access/read-settings/#organization>).
