> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Users REST API (Experimental)

> Reference for the Users REST API, which lists the users and roles visible to the caller, and for the properties that enable it.

The Users REST API lists the users and roles visible to the caller, for instance to suggest whom to share an item with in the Atoti UI.
This page assumes an application that uses the Atoti Server starter.
The endpoint is disabled by default: see [which properties enable and configure it](#which-properties-configure-the-users-endpoint).

> [!WARNING]
>
> The Users REST API and its Java types in `com.activeviam.web.spring.api.users` are experimental and may change in future versions without notice.

## What does the authorities endpoint return?

`GET /activeviam/users/rest/v1/authorities` returns a JSON array of authorities, each with a `name` and a `type`.
They are suggestions, not an allow-list.

```http theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
GET /activeviam/users/rest/v1/authorities?type=user&type=role
```

```json theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
[{"name":"alice","type":"user"},{"name":"ROLE_USER","type":"role"}]
```

| Parameter | Description |
| - | - |
| `type` | Optional. Authority types to return, matched exactly, case-sensitive: repeated (`type=user&type=role`) or comma-separated (`type=user,role`). Defaults to `user` and `role`. The set is open: an unknown type, such as `group`, returns an empty array and no error. |

Without a caller, it returns an empty array.
With the starter's security filter chain, a caller holding none of the roles of `atoti.server.security.roles-user` or `atoti.server.security.roles-admin` receives a `403`.

## Which authorities are returned by default?

Only the caller (when it has a user name), then each of its granted authorities as a role, sorted by name ignoring case.

To return other users and roles, see [How to expose users and roles](https://docs.activeviam.com/engine/java-sdk/6.2/starters/how-to/expose-users-and-roles.md).

## Which properties configure the users endpoint?

Their names are the constants `USERS_ENABLED_PROPERTY` and `USERS_SECURITY_ENABLED_PROPERTY` of `com.activeviam.springboot.atoti.server.starter.api.PropertyNames`.

| Property | Default | Description |
| - | - | - |
| `atoti.server.endpoint.users.enabled` | `false` | `true` exposes the endpoint. Requires the JVM system property below. |
| `atoti.server.endpoint.users.security.enabled` | `false` | `true` adds the starter's security filter chain for `/activeviam/users/**` (authenticated user with a configured Atoti role, `OPTIONS` permitted). Leave it `false` for applications that secure the path themselves. |

The endpoint is experimental, so it is also gated by the JVM system property `activeviam.feature.experimental.users_rest_api.enabled`, which covers the whole `activeviam/users` namespace. Set it to `true` (for example, `-Dactiveviam.feature.experimental.users_rest_api.enabled=true`). If `atoti.server.endpoint.users.enabled` is `true` and the system property is not, the application fails at startup with an error naming the system property.

For all properties, see [Atoti Server properties](https://docs.activeviam.com/engine/java-sdk/6.2/properties/ap_properties.md).
