# Settings

> Organisation model access and the tool catalogue: 7 endpoints of the Teemli API.

Source: https://docs.teemli.com/developers/reference/settings/

Generated from [`api/openapi.yaml`](/developers/api/) (OpenAPI 3.1). Base URL: `https://api.teemli.com`. Auth: `Authorization: Bearer <token or tml_ API key>`. Errors are `application/problem+json`; writes accept an `Idempotency-Key` header.

Organisation model access and the tool catalogue

## Start one-click "Connect OpenRouter" (owner/admin)

```http
POST /v1/orgs/{org}/settings/model/openrouter
```

OpenRouter's OAuth PKCE flow. Returns OpenRouter's consent page; the PKCE verifier stays on
the server for this person (10 minutes). OpenRouter sends the browser to
`/oauth/finish/openrouter?code=…`, and the web app finishes it as the signed-in person
(`POST /v1/oauth/finish/openrouter`): the api exchanges the code and stores the key in the
vault. The key never reaches the browser. Someone else finishing the code gets nothing.

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Responses**

- `200` Where to send the browser — object
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem
- `429` Rate limited (search, link previews, imports, uploads, model key checks): per person and per organisation token buckets. Retry after `Retry-After` seconds. — Problem

## Claim the $10 starter credit (when the server offers one; owner/admin)

```http
POST /v1/orgs/{org}/settings/model/starter
```

Mints a capped per-organisation OpenRouter key with Teemli's management key, puts it behind
the starter guardrail (only the starter model and its helpers) and saves it as the
organisation's key. Guards: a verified email (403); once per normalised email, company
domain and organisation (409), once per device (409), a few per network a day (429); a
platform-wide daily dollar cap and the operator kill switch (503); never for throwaway
inboxes. 404 when the credit is switched off.

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `device` | string | The app's random per-install id (not a fingerprint); kept only as a salted hash |

**Responses**

- `200` Claimed — object
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem
- `409` Conflicting state (card already answered, duplicate in flight, name taken) — Problem
- `429` Rate limited (search, link previews, imports, uploads, model key checks): per person and per organisation token buckets. Retry after `Retry-After` seconds. — Problem

## Models that can use tools, with names and prices (for the model picker; cached for an hour)

```http
GET /v1/orgs/{org}/settings/model/catalog
```

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Responses**

- `200` Models — object

## Model access

```http
GET /v1/orgs/{org}/settings/model
```

The organisation's provider, key hint (never the key), default and fallback model. `can_edit` = owner/admin (in a one-person org, the person).

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Responses**

- `200` Settings — ModelSettings
- `401` Missing, invalid or expired token — Problem

## Set model access (owner/admin)

```http
PUT /v1/orgs/{org}/settings/model
```

`api_key` is validated first (OpenRouter: the free `GET /key`; others: `GET /models`),
then stored in OpenBao — never in the database, never shown again, never sent to
agents. Omitted fields keep their value. Changing `provider` needs a new key.
`base_url` "" = provider default; `fallback_model` "" clears it.

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `provider` | ModelProvider | openrouter (recommended; one key, many models); openai_compatible (any base URL, e.g. vLLM); openai (OpenAI API key, Responses API) |
| `base_url` | string | Required for openai_compatible; must be https and public |
| `api_key` | string |  |
| `default_model` | string |  |
| `fallback_model` | string |  |
| `zero_data_retention` | boolean | Model calls only. Speech-to-text always runs with zero data retention, whatever this says. |
| `context_window_tokens` | `250000`, `500000`, `1000000` |  |

**Responses**

- `200` Saved — ModelSettings & object
- `401` Missing, invalid or expired token — Problem
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem
- `422` Invalid input — Problem

## Check a key without saving it (owner/admin)

```http
POST /v1/orgs/{org}/settings/model/validate
```

For the live "✓ Key works · balance $18.20" check while pasting. 422 when the provider rejects it.

**API keys:** not available (needs a person signed in to the app).

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `api_key` (required) | string |  |
| `provider` | ModelProvider | openrouter (recommended; one key, many models); openai_compatible (any base URL, e.g. vLLM); openai (OpenAI API key, Responses API) |
| `base_url` | string |  |

**Responses**

- `200` The key works — KeyInfo
- `401` Missing, invalid or expired token — Problem
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem
- `422` Invalid input — Problem

## Tool catalogue

```http
GET /v1/orgs/{org}/tools
```

Built-in tools with their action class (drives which actions ask first) and family. Useful for step icons.

**API keys:** needs the `agents:read` scope.

| Parameter | In | Type | Description |
|---|---|---|---|
| `org` (required) | path | string (uuid) | The caller's organisation id. |

**Responses**

- `200` Tools — object
- `401` Missing, invalid or expired token — Problem
