# API keys

> Public API keys (personal and service), scopes, rate limits: 7 endpoints of the Teemli API.

Source: https://docs.teemli.com/developers/reference/api-keys/

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.

Public API keys (personal and service), scopes, rate limits

## My API keys (admins can list service keys)

```http
GET /v1/orgs/{org}/api-keys
```

**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. |
| `kind` | query | `personal`, `service` |  |

**Responses**

- `200` Keys — object
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem

## Create a key (the token is shown once)

```http
POST /v1/orgs/{org}/api-keys
```

**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 |
|---|---|---|
| `name` (required) | string |  |
| `kind` | `personal`, `service` |  |
| `scopes` (required) | array of string |  |
| `expires_in_days` | integer \\| null |  |
| `rate_limit_per_min` | integer |  |

**Responses**

- `201` Created. `token` is shown only now. — object
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem
- `409` Conflicting state (card already answered, duplicate in flight, name taken) — Problem
- `422` Invalid input — Problem

## The scopes a key can have, and whether API access is on

```http
GET /v1/orgs/{org}/api-keys/scopes
```

**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` Scopes — object

## Rename a key or change its rate limit

```http
PATCH /v1/orgs/{org}/api-keys/{id}
```

**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. |
| `id` (required) | path | string (uuid) |  |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `name` | string |  |
| `rate_limit_per_min` | integer |  |

**Responses**

- `200` The key — ApiKey
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Revoke a key (at once)

```http
DELETE /v1/orgs/{org}/api-keys/{id}
```

**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. |
| `id` (required) | path | string (uuid) |  |

**Responses**

- `204` Revoked
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem

## Every key in the organisation (admins; metadata only)

```http
GET /v1/orgs/{org}/admin/api-keys
```

**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` Keys — object
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem

## Revoke anyone's key (admins)

```http
DELETE /v1/orgs/{org}/admin/api-keys/{id}
```

**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. |
| `id` (required) | path | string (uuid) |  |

**Responses**

- `204` Revoked
- `403` Authenticated but not allowed (e.g. unverified email, not the agent's controller, card routed to someone else) — Problem
- `404` Not found (also returned for rows the caller may not see, and for disabled features) — Problem
