---
title: "Substance"
url: "https://dev.4hse.com/api/substance"
---

# Substance

A **Substance** represents a hazardous or chemical substance registered in an office. Examples: solvents, acids, powders, compressed gases.

Belongs to an office and can be subject to check actions on the compliance schedule (ActionSubscription with `subscriber_type: SUBSTANCE`).

Use this API to:

-   Register substances present in an office
-   Get the `office_substance_id` needed to create compliance schedule entries or certificates
-   Browse the substance inventory for an office (filter by `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-indexSubstance-post)

POST

/v2/substance/index

-   

Returns a paginated list of substances.

Most useful filters:

-   `office_id`: all substances in a specific office
-   `name`: search by name

## Authorizations

[Section titled “Authorizations ”](#authorizations)

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

#### Request Body

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

Parameters for searching substances

Select media typeapplication/json

object

**filter**

object

**office\_substance\_id**

Unique identifier. Used as `subscriber_id` (SUBSTANCE) or `resource_id`.

string format: uuid

**office\_id**

string format: uuid

**project\_id**

string format: uuid

**code**

string

**name**

string

**description**

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 substance is currently active.

boolean

nullable

**parent\_active**

Whether the parent office is currently active.

boolean

nullable

**per-page**

integer

default: 100 \>= 1

**page**

integer

default: 1 \>= 1

**sort**

string

Allowed values: code name office\_name project\_name

**history**

If true, includes historicized entries.

boolean

##### Example

```
{  "filter": {    "office_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"  },  "per-page": 20,  "page": 1,  "sort": "name"}
```

#### Responses

[Section titled “ Responses ”](#responses)

##### 200

[Section titled “200 ”](#200)

List of substances

Select media typeapplication/json

Array<object>

object

**office\_substance\_id**

Unique identifier. Used as `subscriber_id` (SUBSTANCE) or `resource_id`.

string format: uuid

**office\_id**

string format: uuid

**project\_id**

string format: uuid

**code**

string

**name**

string

**description**

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 substance is currently active.

boolean

nullable

**parent\_active**

Whether the parent office is 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-createSubstance-post)

POST

/v2/substance/create

-   

Registers a new substance in an office.

Requires `office_id`, `project_id`, and `name`. The `office_substance_id` is auto-generated if not provided.

## Authorizations

[Section titled “Authorizations ”](#authorizations)

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

#### Request Body required

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

Substance to register

Select media typeapplication/json

object

**office\_substance\_id**

Unique identifier. Auto-generated if not provided. Used as `subscriber_id` (with `subscriber_type: SUBSTANCE`) in the compliance schedule and as `resource_id` in certificates.

string format: uuid

**office\_id**

required

The office this substance belongs to. Pass the `office_id`.

string format: uuid

**code**

Identifier code.

string

<= 45 characters

**name**

required

Name of the substance.

string

<= 255 characters

**description**

Optional description.

string

nullable

**project\_id**

required

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

string format: uuid

#### Responses

[Section titled “ Responses ”](#responses)

##### 201

[Section titled “201 ”](#201)

Substance registered successfully

Select media typeapplication/json

object

**office\_substance\_id**

Unique identifier. Auto-generated if not provided. Used as `subscriber_id` (with `subscriber_type: SUBSTANCE`) in the compliance schedule and as `resource_id` in certificates.

string format: uuid

**office\_id**

required

The office this substance belongs to. Pass the `office_id`.

string format: uuid

**code**

Identifier code.

string

<= 45 characters

**name**

required

Name of the substance.

string

<= 255 characters

**description**

Optional description.

string

nullable

**project\_id**

required

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

string format: uuid

### view

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

GET

/v2/substance/view/{id}

-   

Retrieves a single substance by its ID.

## Authorizations

[Section titled “Authorizations ”](#authorizations)

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

#### Path Parameters

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

**id**

required

string format: uuid

The office\_substance\_id to retrieve.

#### Responses

[Section titled “ Responses ”](#responses)

##### 200

[Section titled “200 ”](#200)

Substance found

Select media typeapplication/json

object

**office\_substance\_id**

Unique identifier. Used as `subscriber_id` (SUBSTANCE) or `resource_id`.

string format: uuid

**office\_id**

string format: uuid

**project\_id**

string format: uuid

**code**

string

**name**

string

**description**

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 substance is currently active.

boolean

nullable

**parent\_active**

Whether the parent office is currently active.

boolean

nullable

##### 404

[Section titled “404 ”](#404)

Substance not found

### update

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

PUT

/v2/substance/update/{id}

-   

Updates an existing substance.

## Authorizations

[Section titled “Authorizations ”](#authorizations)

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

#### Path Parameters

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

**id**

required

string format: uuid

The office\_substance\_id to update.

#### Request Body required

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

Fields to update

Select media typeapplication/json

object

**office\_substance\_id**

Unique identifier. Auto-generated if not provided. Used as `subscriber_id` (with `subscriber_type: SUBSTANCE`) in the compliance schedule and as `resource_id` in certificates.

string format: uuid

**office\_id**

required

The office this substance belongs to. Pass the `office_id`.

string format: uuid

**code**

Identifier code.

string

<= 45 characters

**name**

required

Name of the substance.

string

<= 255 characters

**description**

Optional description.

string

nullable

**project\_id**

required

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

string format: uuid

#### Responses

[Section titled “ Responses ”](#responses)

##### 200

[Section titled “200 ”](#200)

Substance updated successfully

Select media typeapplication/json

object

**office\_substance\_id**

Unique identifier. Auto-generated if not provided. Used as `subscriber_id` (with `subscriber_type: SUBSTANCE`) in the compliance schedule and as `resource_id` in certificates.

string format: uuid

**office\_id**

required

The office this substance belongs to. Pass the `office_id`.

string format: uuid

**code**

Identifier code.

string

<= 45 characters

**name**

required

Name of the substance.

string

<= 255 characters

**description**

Optional description.

string

nullable

**project\_id**

required

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

string format: uuid

##### 404

[Section titled “404 ”](#404)

Substance not found

### delete

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

DELETE

/v2/substance/delete/{id}

-   

Deletes a substance.

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

## Authorizations

[Section titled “Authorizations ”](#authorizations)

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

#### Path Parameters

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

**id**

required

string format: uuid

The office\_substance\_id to delete.

#### Query Parameters

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

**force**

boolean

If true, deletes the substance and all child entities.

#### Responses

[Section titled “ Responses ”](#responses)

##### 204

[Section titled “204 ”](#204)

Substance 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.