---
title: "User"
url: "https://dev.4hse.com/api/user"
---

# User

A **User** is an account that can sign in to 4HSE.

Do not confuse it with **Person**, which is a worker recorded for safety compliance: a person does not necessarily have an account, and an account does not necessarily belong to a worker of the company. Compliance data hangs off Person, not off User.

Access is granted to a user through roles, groups and permissions.

Use this API to:

-   Register a new account and update its details
-   Search accounts
-   Remove an account

Version

2.0.0

OpenAPI version

3.0.0

## Authentication

[Section titled “ Authentication ”](#authentication)

### OAuth2

[Section titled “OAuth2 ”](#oauth2)

**Security scheme type:** oauth2

**Flow type:** password

**Token URL:** [https://auth.4hse.com/realms/4hse/protocol/openid-connect/token](https://auth.4hse.com/realms/4hse/protocol/openid-connect/token)

### AccessToken

[Section titled “AccessToken ”](#accesstoken)

**Security scheme type:** apiKey

**Query parameter name:** access-token

## Operations

[Section titled “Operations”](#operations)

### index

[Section titled “index”](#operation-indexUser-post)

POST

/v2/user/index

-   

Returns a paginated and filterable list of users.  
Use POST to allow complex filters via JSON payload.

## Authorizations

[Section titled “Authorizations ”](#authorizations)

-   **[OAuth2](/api/user/#oauth2)**
-   **[AccessToken](/api/user/#accesstoken)**

#### Request Body

[Section titled “Request Body ”](#request-body)

Parameters for searching users

Select media typeapplication/json

object

**filter**

object

**user\_id**

The unique identifier for the user (email address).

string format: email

**username**

The username of the user.

string

**email**

The email address of the user.

string

**status**

The current status of the user (e.g., active, inactive, etc.).

string

**created\_at**

The timestamp when the user was created.

integer

**updated\_at**

The timestamp when the user was last updated.

integer

**per-page**

integer

default: 100 \>= 1

**page**

integer

default: 1 \>= 1

**sort**

Field to sort by. Prefix with minus for descending order (e.g. -username).

string

Allowed values: username email status

##### Example

```
{  "filter": {    "username": "john.doe",    "status": "active"  },  "per-page": 10,  "page": 1,  "sort": "username"}
```

#### Responses

[Section titled “ Responses ”](#responses)

##### 200

[Section titled “200 ”](#200)

List of users

Select media typeapplication/json

Array<object>

object

**user\_id**

The unique identifier for the user (email address).

string format: email

**username**

The username of the user.

string

**email**

The email address of the user.

string

**status**

The current status of the user (e.g., active, inactive, etc.).

string

**created\_at**

The timestamp when the user was created.

integer

**updated\_at**

The timestamp when the user was last updated.

integer

##### Example

```
{  "user_id": "user-1",  "username": "john.doe",  "email": "john.doe@example.com",  "status": "active",  "created_at": 1700000000,  "updated_at": 1700000001}
```

#### Headers

[Section titled “Headers ”](#headers)

**X-Pagination-Current-Page**

integer

Current page

**X-Pagination-Page-Count**

integer

Total number of pages

**X-Pagination-Per-Page**

integer

Number of items per page

**X-Pagination-Total-Count**

integer

Total number of items

### view

[Section titled “view”](#operation-viewUser-get)

GET

/v2/user/view/{id}

-   

Retrieve a user by its unique ID.

## Authorizations

[Section titled “Authorizations ”](#authorizations)

-   **[OAuth2](/api/user/#oauth2)**
-   **[AccessToken](/api/user/#accesstoken)**

#### Path Parameters

[Section titled “Path Parameters ”](#path-parameters)

**id**

required

string format: uuid

ID of the user to retrieve

#### Responses

[Section titled “ Responses ”](#responses)

##### 200

[Section titled “200 ”](#200)

User found

Select media typeapplication/json

object

**user\_id**

The unique identifier for the user (email address).

string format: email

**username**

The username of the user.

string

**email**

The email address of the user.

string

**status**

The current status of the user (e.g., active, inactive, etc.).

string

**created\_at**

The timestamp when the user was created.

integer

**updated\_at**

The timestamp when the user was last updated.

integer

##### Example

```
{  "user_id": "user-1",  "username": "john.doe",  "email": "john.doe@example.com",  "status": "active",  "created_at": 1700000000,  "updated_at": 1700000001}
```

##### 404

[Section titled “404 ”](#404)

User not found

### update

[Section titled “update”](#operation-updateUser-put)

PUT

/v2/user/update/{id}

-   

Update an existing user by its unique ID.

## Authorizations

[Section titled “Authorizations ”](#authorizations)

-   **[OAuth2](/api/user/#oauth2)**
-   **[AccessToken](/api/user/#accesstoken)**

#### Path Parameters

[Section titled “Path Parameters ”](#path-parameters)

**id**

required

string format: uuid

ID of the user to update

#### Request Body required

[Section titled “Request Body required ”](#request-body)

User object with updated data

Select media typeapplication/json

object

**user\_id**

The unique identifier for the user (email address).

string format: email

**username**

The username of the user.

string

**password\_hash**

The hashed password for the user.

string

**password\_reset\_token**

The token used to reset the user’s password (optional).

string

nullable

**email**

The email address of the user.

string

**auth\_key**

The authentication key used for the user’s sessions.

string

**status**

The current status of the user (e.g., active, inactive, etc.).

string

**created\_at**

The timestamp when the user was created.

integer

**updated\_at**

The timestamp when the user was last updated.

integer

**password**

The user’s password, which is write-only and not retrievable.

string

##### Example

```
{  "email": "john.doe@newmail.com",  "status": "inactive"}
```

#### Responses

[Section titled “ Responses ”](#responses)

##### 200

[Section titled “200 ”](#200)

User updated successfully

Select media typeapplication/json

object

**user\_id**

The unique identifier for the user (email address).

string format: email

**username**

The username of the user.

string

**password\_hash**

The hashed password for the user.

string

**password\_reset\_token**

The token used to reset the user’s password (optional).

string

nullable

**email**

The email address of the user.

string

**auth\_key**

The authentication key used for the user’s sessions.

string

**status**

The current status of the user (e.g., active, inactive, etc.).

string

**created\_at**

The timestamp when the user was created.

integer

**updated\_at**

The timestamp when the user was last updated.

integer

**password**

The user’s password, which is write-only and not retrievable.

string

##### Example

```
{  "user_id": "user-1",  "email": "john.doe@newmail.com",  "status": "inactive"}
```

##### 404

[Section titled “404 ”](#404)

User not found

This site is protected by reCAPTCHA and the Google [Privacy Policy](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms) apply.