Attachment
An Attachment represents a file or folder in the file storage system. Files are organized in a folder structure by project and office.
Use this API to:
- Upload a file (e.g. a certificate PDF, a training document)
- Create a folder
- Search files by name, path, or metadata
- Download or view a file
Uploading a file does not automatically associate it with any entity. To link an uploaded file to a certificate, action, or other entity, create an EntityAttachment after uploading the file.
Folder structure convention:
/projects/{project_id}/— project root folder/projects/{project_id}/offices/{office_name}/— office folder
- Version
- 2.0.0
- OpenAPI version
- 3.0.0
Authentication
Section titled “ Authentication ”OAuth2
Section titled “OAuth2 ”Security scheme type: oauth2
Flow type: password
Token URL: https://auth.4hse.com/realms/4hse/protocol/openid-connect/token
AccessToken
Section titled “AccessToken ”Security scheme type: apiKey
Query parameter name: access-token
Operations
Section titled “Operations” POST /v2/attachment/index
Searches files and folders in the file storage.
The index uses a metadata-based search system, different from other index endpoints. Search parameters:
key+value: search by specific metadata (e.g.key: "project_name",value: "Acme Construction Ltd")searchText: full-text search in the file nameroot_path: limit search to a root folderparent_path: limit search to a parent folder
Authorizations
Section titled “Authorizations ”Request Body
Section titled “Request Body ”Parameters for searching attachments
object
Field to sort by. Prefix with minus for descending order.
Metadata key to search by (e.g. “project_name”, “mimetype”).
Value to match for the specified key.
Full-text search in file names.
Limit search to files under this root path.
Limit search to files directly inside this parent folder.
Example
{ "key": "project_name", "value": "Acme Construction Ltd", "per-page": 10, "page": 1, "sort": "attachment_path"}Responses
Section titled “ Responses ”List of attachments
object
MD5 hash of the file path. This is not a UUID — it is derived from the path.
Full path of the file or folder in the storage system (e.g. /projects/{project_id}/offices/{office_name}/document.pdf).
File metadata including mimetype, size, and contextual information (project_id, project_name, etc.).
object
Example
[ { "attachment_id": "452b7448dce72057574d59f93d456ed0", "attachment_path": "/projects/b5a7d602-3fc9-4e2a-9d1a-6e5b4c8f7a01/fire-safety-certificate.pdf", "data": { "mimetype": "application/pdf", "size": "137863", "project_id": "b5a7d602-3fc9-4e2a-9d1a-6e5b4c8f7a01", "project_name": "Acme Construction Ltd" } }]Headers
Section titled “Headers ”Current page
Total number of pages
Number of items per page
Total number of items
GET /v2/attachment/view/{id}
Retrieves a file or its metadata.
The id parameter is the file path or the attachment_id (MD5 hash of the path).
By default returns the file stream (download).
Set Accept: application/json header to get file metadata instead.
The mode parameter controls delivery: download (default) or inline.
Authorizations
Section titled “Authorizations ”Path Parameters
Section titled “Path Parameters ”File path or attachment_id (MD5 hash of the path).
Query Parameters
Section titled “Query Parameters ”Delivery mode for the file.
Responses
Section titled “ Responses ”Attachment found
object
MD5 hash of the file path. This is not a UUID — it is derived from the path.
Full path of the file or folder in the storage system (e.g. /projects/{project_id}/offices/{office_name}/document.pdf).
File metadata including mimetype, size, and contextual information (project_id, project_name, etc.).
object
Example
{ "attachment_id": "452b7448dce72057574d59f93d456ed0", "attachment_path": "/projects/b5a7d602-3fc9-4e2a-9d1a-6e5b4c8f7a01/fire-safety-certificate.pdf", "data": { "mimetype": "application/pdf", "size": "137863", "project_id": "b5a7d602-3fc9-4e2a-9d1a-6e5b4c8f7a01", "project_name": "Acme Construction Ltd" }}Attachment not found
create
Section titled “create” POST /v2/attachment/{id}
Uploads a new file or creates a folder.
The id path parameter is the destination folder (e.g. /projects/{project_id}/offices/{office_name}/).
The path body field is the file name.
The file field is the binary file to upload. If omitted, a folder is created instead.
The replace field (1 or 0) controls whether to overwrite an existing file with the same name.
After upload, the file exists but is not linked to any entity. To link it to a certificate or other entity, create an EntityAttachment.
Authorizations
Section titled “Authorizations ”Path Parameters
Section titled “Path Parameters ”Destination folder path (e.g. /projects/{project_id}/offices/{office_name}/).
Request Body
Section titled “Request Body ”object
The file name (e.g. “fire-safety-certificate.pdf”).
fire-safety-certificate.pdfIf 1, replaces an existing file with the same name. Ignored when creating a folder.
The file to upload. If omitted, a folder is created.
Responses
Section titled “ Responses ”Attachment created successfully
object
MD5 hash of the file path. This is not a UUID — it is derived from the path.
Full path of the file or folder in the storage system (e.g. /projects/{project_id}/offices/{office_name}/document.pdf).
File metadata including mimetype, size, and contextual information (project_id, project_name, etc.).
object
Example
{ "attachment_id": "452b7448dce72057574d59f93d456ed0", "attachment_path": "/projects/b5a7d602-3fc9-4e2a-9d1a-6e5b4c8f7a01/fire-safety-certificate.pdf", "data": { "mimetype": "application/pdf", "size": "137863", "project_id": "b5a7d602-3fc9-4e2a-9d1a-6e5b4c8f7a01", "project_name": "Acme Construction Ltd" }}Bad request
Destination path already exists
File size is too large
Failed to create for unknown reason
update
Section titled “update” PUT /v2/attachment/update/{id}
Renames or moves a file or folder.
The id parameter is the current path. The path body field is the new path.
Authorizations
Section titled “Authorizations ”Path Parameters
Section titled “Path Parameters ”Current file or folder path.
Request Body required
Section titled “Request Body required ”New path for the file or folder
object
The new file or folder path.
Example
{ "path": "/projects/b5a7d602-3fc9-4e2a-9d1a-6e5b4c8f7a01/renamed-certificate.pdf"}Responses
Section titled “ Responses ”Attachment updated successfully
object
MD5 hash of the file path. This is not a UUID — it is derived from the path.
Full path of the file or folder in the storage system (e.g. /projects/{project_id}/offices/{office_name}/document.pdf).
File metadata including mimetype, size, and contextual information (project_id, project_name, etc.).
object
Example
{ "attachment_id": "7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d", "attachment_path": "/projects/b5a7d602-3fc9-4e2a-9d1a-6e5b4c8f7a01/renamed-certificate.pdf"}Bad request
Attachment not found
Destination path already exists
Unable to rename file or folder
delete
Section titled “delete” DELETE /v2/attachment/delete/{id}
Deletes a file or folder.
If force=false (default), the response lists linked entities (EntityAttachment links).
If force=true, the file and all links are deleted.
Authorizations
Section titled “Authorizations ”Path Parameters
Section titled “Path Parameters ”File or folder path to delete.
Query Parameters
Section titled “Query Parameters ”If true, deletes the file and all entity links. If false, returns a preview of affected entities.
Responses
Section titled “ Responses ”Attachment deleted successfully
Preview of linked entities (returned when force=false)