[POST] .../v1/file/add
Creates a new file and returns its ID. Use this method to upload a new user-managed file into REGOS storage and receive the created file identifier for later linking to folders, documents, images or other modules. The endpoint accepts application/json with base64 content in data and also accepts multipart/form-data where the binary part is sent as file and the same metadata fields are form fields. For JSON requests name, extension, data and access_level are required; access_level must be personal or public, folder_id defaults to the root folder and user_id is used only by internal service calls while normal calls use the current request user. The caller must have file add permission and write access to the target folder; missing body or content, invalid lengths, invalid access_level, folder ACL failure, unsupported render metadata database version, file-size quota errors, disk-space quota errors, CDN upload errors and database errors are returned as HTTP 200 ErrorResult business errors.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| access_level | String | Required | File access level for public API calls. Required and must be personal or public; system is reserved for internal service calls. Allowed values: system, personal, public. |
| data | String | Required | File data encoded as base64 for application/json requests. In multipart/form-data requests this is replaced by the binary file form field. |
| duration_ms | Int64 | Optional | Audio/video file duration in milliseconds. Must be zero or greater when supplied. |
| extension | String | Required | File extension without a dot. Required for JSON requests and limited to 10 characters by current endpoint validation. |
| folder_id | Int64 | Optional | Identifier of the folder to add the file to. If not specified, the file is placed in the root folder (id = 1). |
| height | Int32 | Optional | Visual file height in pixels. When supplied, width must also be supplied and both values must be greater than zero. |
| name | String | Required | Display file name. Required for JSON requests and limited to 200 characters by current endpoint validation. |
| user_id | Int64 | Optional | Identifier of the file owner user. Optional for public API calls; normal calls use the current request user and this field is used only in internal service calls. |
| width | Int32 | Optional | Visual file width in pixels. When supplied, height must also be supplied and both values must be greater than zero. |
Request Example
{
"name": "invoice_2026_01.pdf",
"extension": "pdf",
"data": "JVBERi0xLjQKJcTl8uXrp...",
"access_level": "personal",
"folder_id": 10
}
Response Parameters
| Name | Type | Description |
|---|---|---|
| ok | Boolean | Indicates whether the request completed successfully. |
| result | Insert | Created record result. |
Response Example
{
"ok": true,
"result": {
"new_id": 101
}
}