# Users

3 calls. Every request needs the `Authorization` header: see [the overview](https://docs.maitento.com/reference.md).

## `users.list`

```http
GET /users
```

Every user of the tenant (Tenant.Admin).

**Who can call it:** Tenant admins only, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=GET%20%2Fusers).

**Response:** [`User`](https://docs.maitento.com/reference/types/user.md)`[]` (200)

```bash title="curl"
curl -X GET "https://api.maitento.com/users" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
const users = await mt.users.list();
```
```python title="Python"
mt.users.list()
```

## `users.update`

```http
PUT /users/by-id/{id}
```

Grants or removes admin, enables or disables a user (Tenant.Admin).

**Who can call it:** Tenant admins only, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=PUT%20%2Fusers%2Fby-id%2F%7Bid%7D).

**Path parameters**

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | `uuid` | yes |  |

**Request body:** [`UserUpdateRequest`](https://docs.maitento.com/reference/types/user-update-request.md)

| Field | Type | Required | Description |
|---|---|---|---|
| `isAdmin` | `boolean` |  | True to make the user a tenant admin (`Tenant.Admin`); false for an ordinary member (`Tenant.User`). |
| `isEnabled` | `boolean` |  | Whether the user may sign in. |

**Response:** no body (204)

```bash title="curl"
curl -X PUT "https://api.maitento.com/users/by-id/<id>" \
  -H "Authorization: $MAITENTO_AUTH" \
  -H "Content-Type: application/json" \
  -d '{"isAdmin":false,"isEnabled":false}'
```
```ts title="TypeScript"
await mt.users.update("b814ac02-0000-4000-8000-000000000001", { isAdmin: false, isEnabled: true });
```
```python title="Python"
mt.users.update("5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b", is_admin=False, is_enabled=True)
```

## `users.self`

```http
GET /users/self
```

The caller: user, tenant and roles. `user.id` is the user id an API key is written with (`"<userId>:<secret>"`).

**Who can call it:** Admins and members, with an API key or a portal session. [Try it in the API playground](https://docs.maitento.com/playground/?call=GET%20%2Fusers%2Fself).

**Response:** [`CurrentUserResponse`](https://docs.maitento.com/reference/types/current-user-response.md) (200)

```bash title="curl"
curl -X GET "https://api.maitento.com/users/self" \
  -H "Authorization: $MAITENTO_AUTH"
```
```ts title="TypeScript"
const { user, tenant, roles } = await mt.users.self();
```
```python title="Python"
mt.users.self()
```
