---
title: "EntityEmployee"
url: "https://dev.4hse.com/api/entityemployee"
---

# EntityEmployee

An **EntityEmployee** represents the assignment of a person to an office resource: a safety role, a piece of equipment, a work environment, or a substance.

For example: assigning “John Smith” to the role “Safety Officer” or to the equipment “Forklift A”.

The `entity_id` field contains the resource ID and the `type` field specifies its kind:

-   `ROLE`: a safety organization role (`office_role_id`)
-   `EQUIPMENT`: a piece of equipment (`office_equipment_id`)
-   `WORK_ENVIRONMENT`: a work environment (`office_work_environment_id`)
-   `SUBSTANCE`: a substance (`office_substance_id`)

Use this API to:

-   Assign a person to a role, equipment, work environment, or substance
-   Find all people assigned to a resource (filter by `entity_id`)
-   Find all resources a person is assigned to (filter by `person_office_id`)

Supports historicization.

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-indexEntityEmployee-post)

POST

/v2/entity-employee/index

-   

Returns a paginated list of person-resource assignments.

Most useful filters:

-   `entity_id`: all people assigned to a specific resource
-   `person_office_id`: all resources a person is assigned to
-   `type`: filter by resource type (`ROLE`, `EQUIPMENT`, `WORK_ENVIRONMENT`, `SUBSTANCE`)
-   `office_id`: all assignments in an office

## Authorizations

[Section titled “Authorizations ”](#authorizations)

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

#### Request Body

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

Parameters for searching

Select media typeapplication/json

object

**filter**

object

**entity\_employee\_id**

string format: uuid

**entity\_id**

string format: uuid

**person\_office\_id**

string format: uuid

**type**

string

Allowed values: EQUIPMENT WORK\_ENVIRONMENT SUBSTANCE ROLE

**office\_id**

string format: uuid

**project\_id**

string format: uuid

**person\_id**

The person ID.

string format: uuid

**person\_code**

Employee code.

string

**person\_first\_name**

string

**person\_last\_name**

string

**person\_is\_external**

Whether the person is external prevention staff.

boolean

**entity\_code**

Code of the assigned resource.

string

**entity\_name**

Name of the assigned resource.

string

**office\_name**

Name of the office.

string

**project\_name**

Name of the project.

string

**project\_type**

string

Allowed values: safety template

**owned\_active**

Whether this assignment is currently active.

boolean

nullable

**parent\_active**

Whether the parent entities are currently active.

boolean

nullable

**per-page**

integer

default: 100 \>= 1

**page**

integer

default: 1 \>= 1

**sort**

string

Allowed values: person\_code person\_first\_name person\_last\_name entity\_code entity\_name type

**history**

If true, includes historicized entries.

boolean

##### Example

```
{  "filter": {    "entity_id": "1a2b3c4d-5e6f-7890-abcd-ef1234567890",    "type": "ROLE"  },  "per-page": 20,  "page": 1,  "sort": "person_last_name"}
```

#### Responses

[Section titled “ Responses ”](#responses)

##### 200

[Section titled “200 ”](#200)

List of person-resource assignments

Select media typeapplication/json

Array<object>

object

**entity\_employee\_id**

string format: uuid

**entity\_id**

string format: uuid

**person\_office\_id**

string format: uuid

**type**

string

Allowed values: EQUIPMENT WORK\_ENVIRONMENT SUBSTANCE ROLE

**office\_id**

string format: uuid

**project\_id**

string format: uuid

**person\_id**

The person ID.

string format: uuid

**person\_code**

Employee code.

string

**person\_first\_name**

string

**person\_last\_name**

string

**person\_is\_external**

Whether the person is external prevention staff.

boolean

**entity\_code**

Code of the assigned resource.

string

**entity\_name**

Name of the assigned resource.

string

**office\_name**

Name of the office.

string

**project\_name**

Name of the project.

string

**project\_type**

string

Allowed values: safety template

**owned\_active**

Whether this assignment is currently active.

boolean

nullable

**parent\_active**

Whether the parent entities are currently active.

boolean

nullable

#### 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

### create

[Section titled “create”](#operation-createEntityEmployee-post)

POST

/v2/entity-employee/create

-   

Assigns a person to a resource.

Requires `entity_id`, `person_office_id`, `office_id`, and `project_id`. The `entity_employee_id` is auto-generated if not provided.

What to pass as `entity_id` depends on the `type`:

-   `ROLE`: pass the `office_role_id`
-   `EQUIPMENT`: pass the `office_equipment_id`
-   `WORK_ENVIRONMENT`: pass the `office_work_environment_id`
-   `SUBSTANCE`: pass the `office_substance_id`

## Authorizations

[Section titled “Authorizations ”](#authorizations)

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

#### Request Body required

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

Assignment to create

Select media typeapplication/json

object

**entity\_employee\_id**

Unique identifier. Auto-generated if not provided.

string format: uuid

**entity\_id**

required

The resource this person is assigned to. What to pass depends on `type`:

-   `ROLE`: pass the `office_role_id`
-   `EQUIPMENT`: pass the `office_equipment_id`
-   `WORK_ENVIRONMENT`: pass the `office_work_environment_id`
-   `SUBSTANCE`: pass the `office_substance_id`

string format: uuid

**person\_office\_id**

required

The person-office assignment. Pass the `person_office_id` from the PersonOffice API.

string format: uuid

**type**

Type of resource:

-   `ROLE`: a safety organization role
-   `EQUIPMENT`: a piece of equipment
-   `WORK_ENVIRONMENT`: a work environment
-   `SUBSTANCE`: a substance

string

<= 50 characters

Allowed values: EQUIPMENT WORK\_ENVIRONMENT SUBSTANCE ROLE

**office\_id**

required

The office. Pass the `office_id`.

string format: uuid

**project\_id**

required

The project (company). Pass the `project_id`.

string format: uuid

#### Responses

[Section titled “ Responses ”](#responses)

##### 201

[Section titled “201 ”](#201)

Assignment created successfully

Select media typeapplication/json

object

**entity\_employee\_id**

Unique identifier. Auto-generated if not provided.

string format: uuid

**entity\_id**

required

The resource this person is assigned to. What to pass depends on `type`:

-   `ROLE`: pass the `office_role_id`
-   `EQUIPMENT`: pass the `office_equipment_id`
-   `WORK_ENVIRONMENT`: pass the `office_work_environment_id`
-   `SUBSTANCE`: pass the `office_substance_id`

string format: uuid

**person\_office\_id**

required

The person-office assignment. Pass the `person_office_id` from the PersonOffice API.

string format: uuid

**type**

Type of resource:

-   `ROLE`: a safety organization role
-   `EQUIPMENT`: a piece of equipment
-   `WORK_ENVIRONMENT`: a work environment
-   `SUBSTANCE`: a substance

string

<= 50 characters

Allowed values: EQUIPMENT WORK\_ENVIRONMENT SUBSTANCE ROLE

**office\_id**

required

The office. Pass the `office_id`.

string format: uuid

**project\_id**

required

The project (company). Pass the `project_id`.

string format: uuid

### view

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

GET

/v2/entity-employee/view/{id}

-   

Retrieves a single assignment by its ID.

## Authorizations

[Section titled “Authorizations ”](#authorizations)

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

#### Path Parameters

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

**id**

required

string format: uuid

The entity\_employee\_id to retrieve.

#### Responses

[Section titled “ Responses ”](#responses)

##### 200

[Section titled “200 ”](#200)

Assignment found

Select media typeapplication/json

object

**entity\_employee\_id**

string format: uuid

**entity\_id**

string format: uuid

**person\_office\_id**

string format: uuid

**type**

string

Allowed values: EQUIPMENT WORK\_ENVIRONMENT SUBSTANCE ROLE

**office\_id**

string format: uuid

**project\_id**

string format: uuid

**person\_id**

The person ID.

string format: uuid

**person\_code**

Employee code.

string

**person\_first\_name**

string

**person\_last\_name**

string

**person\_is\_external**

Whether the person is external prevention staff.

boolean

**entity\_code**

Code of the assigned resource.

string

**entity\_name**

Name of the assigned resource.

string

**office\_name**

Name of the office.

string

**project\_name**

Name of the project.

string

**project\_type**

string

Allowed values: safety template

**owned\_active**

Whether this assignment is currently active.

boolean

nullable

**parent\_active**

Whether the parent entities are currently active.

boolean

nullable

##### 404

[Section titled “404 ”](#404)

Assignment not found

### update

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

PUT

/v2/entity-employee/update/{id}

-   

Updates an existing assignment.

## Authorizations

[Section titled “Authorizations ”](#authorizations)

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

#### Path Parameters

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

**id**

required

string format: uuid

The entity\_employee\_id to update.

#### Request Body required

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

Fields to update

Select media typeapplication/json

object

**entity\_employee\_id**

Unique identifier. Auto-generated if not provided.

string format: uuid

**entity\_id**

required

The resource this person is assigned to. What to pass depends on `type`:

-   `ROLE`: pass the `office_role_id`
-   `EQUIPMENT`: pass the `office_equipment_id`
-   `WORK_ENVIRONMENT`: pass the `office_work_environment_id`
-   `SUBSTANCE`: pass the `office_substance_id`

string format: uuid

**person\_office\_id**

required

The person-office assignment. Pass the `person_office_id` from the PersonOffice API.

string format: uuid

**type**

Type of resource:

-   `ROLE`: a safety organization role
-   `EQUIPMENT`: a piece of equipment
-   `WORK_ENVIRONMENT`: a work environment
-   `SUBSTANCE`: a substance

string

<= 50 characters

Allowed values: EQUIPMENT WORK\_ENVIRONMENT SUBSTANCE ROLE

**office\_id**

required

The office. Pass the `office_id`.

string format: uuid

**project\_id**

required

The project (company). Pass the `project_id`.

string format: uuid

#### Responses

[Section titled “ Responses ”](#responses)

##### 200

[Section titled “200 ”](#200)

Assignment updated successfully

Select media typeapplication/json

object

**entity\_employee\_id**

Unique identifier. Auto-generated if not provided.

string format: uuid

**entity\_id**

required

The resource this person is assigned to. What to pass depends on `type`:

-   `ROLE`: pass the `office_role_id`
-   `EQUIPMENT`: pass the `office_equipment_id`
-   `WORK_ENVIRONMENT`: pass the `office_work_environment_id`
-   `SUBSTANCE`: pass the `office_substance_id`

string format: uuid

**person\_office\_id**

required

The person-office assignment. Pass the `person_office_id` from the PersonOffice API.

string format: uuid

**type**

Type of resource:

-   `ROLE`: a safety organization role
-   `EQUIPMENT`: a piece of equipment
-   `WORK_ENVIRONMENT`: a work environment
-   `SUBSTANCE`: a substance

string

<= 50 characters

Allowed values: EQUIPMENT WORK\_ENVIRONMENT SUBSTANCE ROLE

**office\_id**

required

The office. Pass the `office_id`.

string format: uuid

**project\_id**

required

The project (company). Pass the `project_id`.

string format: uuid

##### 404

[Section titled “404 ”](#404)

Assignment not found

### delete

[Section titled “delete”](#operation-deleteEntityEmployee-delete)

DELETE

/v2/entity-employee/delete/{id}

-   

Deletes a person-resource assignment.

If `force=false` (default), the response lists child entities. If `force=true`, the assignment and related entities are deleted.

## Authorizations

[Section titled “Authorizations ”](#authorizations)

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

#### Path Parameters

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

**id**

required

string format: uuid

The entity\_employee\_id to delete.

#### Query Parameters

[Section titled “Query Parameters ”](#query-parameters)

**force**

boolean

If true, deletes the assignment and all child entities.

#### Responses

[Section titled “ Responses ”](#responses)

##### 204

[Section titled “204 ”](#204)

Assignment deleted successfully

##### 400

[Section titled “400 ”](#400)

Preview of entities that would be deleted (returned when force=false)

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.