# Files.fm API V2 REST Documentation

Generated from `Files.fm_API_docs_EN_v.1.9.5.pdf` version 1.9.5, dated 2026-05-01. Concrete access tokens from PDF examples are replaced with placeholders.

This page starts with the REST API used by programmers to create folders, upload files, download files, manage metadata, move/delete/restore items, and work with e-signature-related file flows. The e-signature embedded form, hosted AI endpoint, upload form, embedding, previews, conversion, and analysis sections are included later as supplementary integration notes.

## REST API Overview

Base URL:

```text
https://api.files.fm
```

API V2 action URLs generally use:

```text
https://api.files.fm/api_v2/{action}
```

Prefer `POST` for API parameters unless an endpoint explicitly documents `GET` as accepted. Successful REST responses are JSON unless the endpoint returns raw file content, such as `download_file`.

### Common Integration Flow

1. Generate an API key at `https://files.fm/account#api_keys` or use a dedicated user/service account.
2. Create a folder with `create_folder`; store `folder_hash`, `folder_edit_key`, and `folder_upload_key` in your own database.
3. Upload files with `upload_file` using authentication or the folder upload key.
4. List or inspect content with `get_folder_content`, `get_file_info`, and `get_folder_info`.
5. Download files with `download_file`.
6. Rename, move, delete, or restore files/folders as needed.

### Important Concepts

- Every file and folder has a unique hash. Store hashes and the corresponding edit/upload/delete keys in your system.
- Folder/file access can be `PRIVATE`, `LINK`, or `PASSWORD` where supported.
- `LINK` access allows reading/listing/downloading by anyone who knows the hash/link.
- `PRIVATE` access requires authorization and explicit rights.
- Files and folders created through the API can also be managed in the Files.fm UI at `https://files.fm/filebrowser`.
- API requests may be rate-limited or blocked by automated web firewall checks if request patterns look abusive.
- Business and Enterprise integrations needing higher limits, dedicated access rules, or production support should contact `support@files.fm`.

### Authorization

Supported authorization methods:

| Method | How to send credentials | Notes |
| --- | --- | --- |
| Basic HTTP authentication | HTTP `Authorization` header | Username/password style authentication. |
| POST parameters | `user` and `pass`, or token fields where supported | Preferred over GET for credentials. |
| GET parameters | `user` and `pass` | Supported for compatibility, but avoid for sensitive credentials where possible. |
| API token | `user_access_token` with user/service-account identity where supported | Generate at `https://files.fm/account#api_keys`. |
| Existing session | Valid Files.fm session/cookies | Supported by some authenticated actions. |

### HTTP Status Codes

| Status | Meaning | Action |
| --- | --- | --- |
| `200 OK` | Request succeeded. | Process the returned JSON or binary content. |
| `400 Bad Request` | Invalid or incomplete parameters. | Check required parameters and formats. |
| `401 Unauthorized` | Authorization failed or is missing. | Check credentials, token, or session. |
| `403 Forbidden` | Authenticated user does not have access rights. | Change access type or share the resource with the user. |
| `405 Method Not Allowed` | Requested operation is not permitted for this resource. | Check file/folder hash and permissions. |
| `429 Too Many Requests` | Rate limit hit. | Wait for the rate limit to expire and retry later. |
| `500 Internal Server Error` | Backend/API service error. | Retry later or contact Files.fm support. |

### Endpoint Summary

| Action | Method | Endpoint | Purpose |
| --- | --- | --- | --- |
| `create_folder` | `POST` | `/api_v2/create_folder` | Create a folder in ROOT or a parent folder. |
| `upload_file` | `POST multipart/form-data` | `/api_v2/upload_file` | Upload a file to an existing folder. |
| `download_file` | `POST` | `/api_v2/download_file` | Download raw file contents by file hash. |
| `delete_folder` | `POST` | `/api_v2/delete_folder` | Delete a folder. |
| `undelete_folder` | `POST` or `GET` | `/undelete_folder` | Restore a deleted folder. |
| `delete_file` | `POST` | `/api_v2/delete_file` | Delete a file. |
| `undelete_file` | `POST` or `GET` | `/undelete_file` | Restore a deleted file. |
| `get_folder_content` | `POST` | `/api_v2/get_folder_content` | List files and subfolders in a folder. |
| `move_file` | `POST` | `/api_v2/move_file` | Move a file into another folder. |
| `get_file_info` | `POST` | `/api_v2/get_file_info` | Read file metadata. |
| `get_folder_info` | `POST` | `/api_v2/get_folder_info` | Read folder metadata. |
| `get_esignatures` | `POST` | `/api_v2/get_esignatures` | List e-signatures for a file. |
| `esignature_share` | `POST` | `/api_v2/esignature_share` | Share a file for signing. |
| `rename_file` | `POST` | `/api_v2/rename_file` | Rename a file. |
| `rename_folder` | `POST` | `/api_v2/rename_folder` | Rename a folder. |

## REST Endpoints

### create_folder

Creates a new folder in the user's account and sets its access rights.

```text
POST https://api.files.fm/api_v2/create_folder
```

Authorization: mandatory.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `parent_folder_hash` | string | No | Parent folder hash. If omitted, the new folder is created in the authenticated user's ROOT folder. ROOT exists for all accounts and contains metadata such as `subfolder_count` and `file_count`. |
| `folder_name` | string | No | Folder name. If omitted, a random name is generated in `YYYY-MM-DD_folderhash` format. If the same name exists in the target path, Files.fm adds a suffix such as `NAME (1)`. |
| `access_type` | string | No | `LINK` or `PRIVATE`. `LINK` allows read/list access to anyone who knows the hash/link. `PRIVATE` allows access only to the owner and users with shared rights. |

Example:

```bash
curl -sS --max-time 25 -X POST 'https://api.files.fm/api_v2/create_folder' \
  -d 'user=YOUR_USERNAME' \
  -d 'user_access_token=YOUR_API_TOKEN' \
  -d 'folder_name=MY_FOLDER_NAME' \
  -d 'access_type=PRIVATE'
```

Success response:

```json
{
  "folder_hash": "xxxxxxxxx",
  "folder_edit_key": "xxxxxxxx",
  "folder_upload_key": "xxxxx",
  "folder_name": "Name given"
}
```

Response fields:

| Name | Type | Description |
| --- | --- | --- |
| `folder_hash` | string | Identifier of the created folder. |
| `folder_edit_key` | string | Key that grants permission to modify the folder. |
| `folder_upload_key` | string | Key that grants permission to upload files to the folder. |
| `folder_name` | string | Final folder name. If the requested name already existed, this may include a uniqueness suffix. |

Folder access link example:

```text
https://files.fm/u/{folder_hash}
```

Errors: standard status codes from the REST overview.

### upload_file

Uploads a file to an existing folder. Create a target folder before uploading. Do not upload files directly to ROOT; it is always private. Upload limits may apply by account tier.

```text
POST https://api.files.fm/api_v2/upload_file
Content-Type: multipart/form-data
```

Authorization: optional if `folder_upload_key` is provided and valid; otherwise authenticate the user.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `folder_hash` | string | Yes | Target folder hash. |
| `folder_upload_key` | string | No | Folder key that grants upload permission without full folder access. Required when not authenticating and using a known folder upload key. |
| `file` | binary | Yes | File content. PDF examples also show multipart fields such as `Filedata` and `fileToUpload`; use `file` unless your integration is based on an older example flow. |
| `watermark_text` | string | No | Text watermark for JPG/PNG uploads. |
| `watermark_position` | string | No | `TOP_LEFT`, `TOP_RIGHT`, `BOTTOM_LEFT`, or `BOTTOM_RIGHT`. |
| `watermark_color` | string | No | Watermark color. Default: `F0FF3C`. |

Upload using folder upload key:

```bash
curl -X POST 'https://api.files.fm/api_v2/upload_file' \
  -F 'folder_hash=TARGET_FOLDER_HASH' \
  -F 'folder_upload_key=TARGET_ADD_KEY' \
  -F 'file=@/path/to/local/file.pdf'
```

Upload using account credentials/token:

```bash
printf 'upload_file API test at %s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" | \
curl -sS --max-time 40 -X POST 'https://api.files.fm/api_v2/upload_file' \
  -F 'user=YOUR_USERNAME' \
  -F 'user_access_token=YOUR_API_TOKEN' \
  -F 'folder_hash=TARGET_FOLDER_HASH' \
  -F 'file=@-;filename=api_v2_upload_test.txt;type=text/plain'
```

Success response:

```json
{
  "file_hash": "xxxxxxxxx",
  "file_delete_key": "xxxxxxxxx",
  "file_name": "api_v2_upload_test (2).txt",
  "timestamp_uploaded": 1777638342,
  "timestamp_last_modified": 1777638342
}
```

Response fields:

| Name | Type | Description |
| --- | --- | --- |
| `file_hash` | string | Identifier of the uploaded file. |
| `file_delete_key` | string | File edit/delete key. |
| `file_name` | string | Final stored file name. If a duplicate exists, Files.fm may add a suffix such as `(1)`. |
| `timestamp_uploaded` | integer | Upload timestamp. |
| `timestamp_last_modified` | integer | Last-modified timestamp. |

Additional upload-specific errors:

| Status | Message | Meaning | Action |
| --- | --- | --- | --- |
| `490` | Virus detected | Uploaded file was detected as infected and was not stored. | Do not retry unchanged; show an appropriate error. |
| `491` | File Name Double Extension | File name contains a double extension, for example `invoice.pdf.exe`. | Do not retry unchanged; show an appropriate error. |
| `492` | Folder Size Limit Exceeded | Upload would exceed the folder size limit. | Do not retry unchanged; reduce size or use a suitable account plan. |
| `493` | File Size Limit Exceeded | Uploaded file exceeds the file size limit. | Do not retry unchanged; reduce size or use a suitable account plan. |
| `494` | Partial upload | Full-size file was not received. | Retry after checking client/network timeout limits. |

Documented file-size limits:

| Account type | File-size limit |
| --- | --- |
| Enterprise | 50 GB or larger by agreement |
| Business | 50 GB or larger by agreement |
| Pro | 20 GB |
| Lifetime | 10 GB |
| Personal | 10 GB |
| Free | 5 GB |

Documented folder-size limits: Enterprise, Business, Pro, Lifetime, and Personal are unlimited; Free is 5 GB.

### download_file

Downloads raw file contents by file hash.

```text
POST https://api.files.fm/api_v2/download_file
```

Authorization:

| File access | Authorization |
| --- | --- |
| `PRIVATE` | Required. |
| `LINK` | Not required. The file can be downloaded or embedded without authentication. |

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `file_hash` | string | Yes | File hash. |

Response:

- Success: raw binary file contents.
- `Content-Type`: automatically set based on file type.
- `Content-Disposition`: inline or attachment depending on client and access settings.

Public LINK example:

```text
https://files.fm/f/demo
```

Legacy V1 compatibility endpoint, available but not recommended for new integrations:

```text
https://api.files.fm/down.php?i=rktesv5b
```

Direct file path links may also be used where configured:

```text
https://files.fm/pa/username/folder1/subfolder/filename.jpg
```

Errors: standard status codes from the REST overview.

### delete_folder

Deletes a folder from a user account.

```text
POST https://api.files.fm/api_v2/delete_folder
```

Authorization: required.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `folder_hash` | string | Yes | Folder hash to delete. |

Response:

```json
{"status":"ok"}
```

or:

```json
{"status":"error"}
```

Errors: standard status codes from the REST overview.

### undelete_folder

Restores a previously deleted folder. Recoverable files in the folder are restored immediately. The restoration window depends on account type and configuration.

```text
POST https://api.files.fm/undelete_folder
GET  https://api.files.fm/undelete_folder?hash=demo
```

Authorization: required.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `hash` | string | Yes | Folder hash to restore. |

Response:

```json
{"status":"ok"}
```

or:

```json
{"status":"error"}
```

### delete_file

Deletes a file.

```text
POST https://api.files.fm/api_v2/delete_file
```

Authorization: required.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `file_hash` | string | Yes | File hash to delete. |

Response: no additional data documented.

Errors: standard status codes from the REST overview.

### undelete_file

Restores a deleted file. Restore availability depends on account type and configuration.

```text
POST https://api.files.fm/undelete_file
GET  https://api.files.fm/undelete_file?hash=demo
```

Authorization: required.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `hash` | string | Yes | File hash to restore. |

Response:

```json
{"status":"ok"}
```

or:

```json
{"status":"error"}
```

### get_folder_content

Returns the direct contents of a folder, including files and subfolders.

```text
POST https://api.files.fm/api_v2/get_folder_content
```

Authorization: required.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `folder_hash` | string | Yes | Folder hash whose contents should be listed. |

Response: JSON array of file/folder objects.

```json
[
  {
    "type": "file",
    "hash": "xxxxxxxxx",
    "name": "example.pdf",
    "size": 12345,
    "timestamp_uploaded": 1777638342,
    "timestamp_last_modified": 1777638342,
    "delete_key": "xxxxxx",
    "add_files_key": null
  },
  {
    "type": "folder",
    "hash": "yyyyyyyyy",
    "name": "Subfolder",
    "size": 0,
    "timestamp_uploaded": 1777638342,
    "timestamp_last_modified": 1777638342,
    "delete_key": "yyyyyy",
    "add_files_key": "zzzzz"
  }
]
```

Response fields:

| Name | Type | Description |
| --- | --- | --- |
| `type` | string | `file` or `folder`. |
| `hash` | string | File or subfolder hash. |
| `name` | string | File or subfolder name. |
| `size` | integer | File or folder size in bytes. |
| `timestamp_uploaded` | integer | Upload timestamp. |
| `timestamp_last_modified` | integer | Last modification timestamp. |
| `delete_key` | string | File or folder edit/delete key if available. |
| `add_files_key` | string | Folder upload/add key for subfolders if available. |

Errors: standard status codes from the REST overview.

### move_file

Moves a file into another folder in the same account.

```text
POST https://api.files.fm/api_v2/move_file
```

Authorization: mandatory.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `file_hash` | string | Yes | File hash to move. |
| `folder_hash` | string | Yes | Target folder hash. |

Response: no additional data documented.

Errors: standard status codes. Status `405` may be returned if the target folder does not exist or the operation is not allowed.

### get_file_info

Returns metadata for a file.

```text
POST https://api.files.fm/api_v2/get_file_info
```

Authorization: required.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `file_hash` | string | Yes | File hash. |

Success response:

```json
{
  "hash": "xxxxxxxxx",
  "name": "example.pdf",
  "size": 12345,
  "timestamp_uploaded": 1777638342,
  "timestamp_last_modified": 1777638342,
  "delete_key": "xxxxxx",
  "parent_folder_hash": "yyyyyyyyy"
}
```

Response fields:

| Name | Type | Description |
| --- | --- | --- |
| `hash` | string | File hash. |
| `name` | string | File name. |
| `size` | integer | File size in bytes. |
| `timestamp_uploaded` | integer | Upload timestamp. |
| `timestamp_last_modified` | integer | Last modification timestamp. |
| `delete_key` | string or null | File edit/delete key. `null` is returned if the caller has no delete permission. |
| `parent_folder_hash` | string or null | Parent folder hash. `null` is returned if the caller cannot view the parent folder. |

Errors: standard status codes from the REST overview.

### get_folder_info

Returns metadata for a folder.

```text
POST https://api.files.fm/api_v2/get_folder_info
```

Authorization: required.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `folder_hash` | string | Yes | Folder hash. |

Success response:

```json
{
  "hash": "xxxxxxxxx",
  "name": "Folder name",
  "size": 12345,
  "timestamp_uploaded": 1777638342,
  "timestamp_last_modified": 1777638342,
  "delete_key": "xxxxxx",
  "parent_folder_hash": "yyyyyyyyy",
  "add_files_key": "zzzzz",
  "file_count": 10,
  "subfolder_count": 2
}
```

Response fields:

| Name | Type | Description |
| --- | --- | --- |
| `hash` | string | Folder hash. |
| `name` | string | Folder name. |
| `size` | integer | Folder size in bytes. |
| `timestamp_uploaded` | integer | Upload/creation timestamp. |
| `timestamp_last_modified` | integer | Last modification timestamp. |
| `delete_key` | string or null | Folder edit/delete key. `null` is returned if the caller cannot delete the folder. |
| `parent_folder_hash` | string or null | Parent folder hash. `null` is returned if the caller cannot view the parent folder. |
| `add_files_key` | string or null | Upload/add key. `null` is returned if the caller cannot modify the folder. |
| `file_count` | integer | Number of files in the folder and subfolders. |
| `subfolder_count` | integer | Number of subfolders. |

Errors: standard status codes from the REST overview.

### get_esignatures

Returns e-signature records for a file.

```text
POST https://api.files.fm/api_v2/get_esignatures
```

Authorization: required.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `file_hash` | string | Yes | File hash whose e-signatures should be returned. |
| `from_date` | string | No | Inclusive start date filter for signature timestamps. |
| `to_date` | string | No | Inclusive end date filter for signature timestamps. |

Success response:

```json
[
  {
    "file_hash": "xxxxxxxxx",
    "signing_timestamp": "xxxxxxxxx",
    "signer_name": "Signer Name"
  }
]
```

Response fields:

| Name | Type | Description |
| --- | --- | --- |
| `file_hash` | string | File hash. |
| `signing_timestamp` | string | Datetime when the file was signed. |
| `signer_name` | string | Signer's name and surname. |

Errors: standard status codes from the REST overview.

### esignature_share

Shares a file to be signed by other users. Optional `next_share_emails` can prefill the next share dialog so the recipient can re-share the file.

```text
POST https://api.files.fm/api_v2/esignature_share
```

Authorization: required.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `file_hash` | string | Yes | File hash that should be shared for signing. |
| `text` | string | No | Message included in the sharing email. |
| `emails` | string[] | Yes | Recipients that receive the signing request email. |
| `next_share_emails` | string[] | No | Email addresses prefilled for recipients that may re-share the signing request. |

Success response:

```json
{
  "status": "ok",
  "sent_emails": "person@example.com",
  "next_share_emails": "next@example.com"
}
```

Response fields:

| Name | Type | Description |
| --- | --- | --- |
| `status` | string | Request status. |
| `sent_emails` | string | Comma-separated list of emails that received the signing request. |
| `next_share_emails` | string | Comma-separated list of emails prefilled for the next share step. |

Errors: standard status codes from the REST overview.

### rename_file

Renames an existing file and returns the final stored filename.

```text
POST https://api.files.fm/api_v2/rename_file
```

Authorization: required. Supported auth methods are the same as other API V2 actions, including `user` + `pass`, valid session, and token/session flows supported by Files.fm authentication.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `file_hash` | string | Yes | File hash to rename. |
| `file_name` | string | Yes | Desired new file name. |

Access and behavior:

- Caller must have edit rights for the file.
- Deleted or missing files return an error.
- The filename is normalized and made unique inside the folder.
- If the requested name equals the current name, API returns success with unchanged name.

Success response:

```json
{
  "file_hash": "ahgavbqr2d",
  "file_name": "renamed_from_curl_test.txt"
}
```

`file_name` is the final name after normalization and uniqueness handling.

Common errors:

| Status | Meaning |
| --- | --- |
| `400 Bad Request` | Missing `file_hash` or `file_name`. |
| `401 Unauthorized` | Caller is not authenticated. |
| `405 Method Not Allowed` | File not found or caller has no edit permission. |
| `500 Internal Server Error` | Unexpected backend error. |

Example:

```bash
curl -X POST 'https://api.files.fm/api_v2/rename_file' \
  --data-urlencode 'file_hash=YOUR_FILE_HASH' \
  --data-urlencode 'file_name=New file name.pdf' \
  --data-urlencode 'user=YOUR_USERNAME' \
  --data-urlencode 'pass=YOUR_PASSWORD'
```

### rename_folder

Renames an existing folder that the authenticated user is allowed to edit.

```text
POST https://api.files.fm/api_v2/rename_folder
```

Authorization: required.

Parameters:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `folder_hash` | string | Yes | Folder hash to rename. |
| `folder_name` | string | Yes | Desired new folder name. |
| `name` | string | No | Alias for `folder_name`. If both are sent, `folder_name` is used. |

Access and behavior:

- Caller must be authenticated.
- Folder must exist and must not be deleted.
- Caller must have folder `allow_edit` rights.
- ROOT folder (`ParentID = 0`) cannot be renamed.
- Folder name is normalized and made unique inside the parent folder.
- Successful rename triggers the standard folder change event pipeline, including ETag/update side effects.

Success response:

```json
{
  "folder_hash": "dkjse72whr",
  "folder_name": "rf_evt_renamed_1777640861"
}
```

`folder_name` is the final name after normalization and uniqueness handling.

Common errors:

| Status | Meaning |
| --- | --- |
| `400 Bad Request` | Missing `folder_hash` or `folder_name`. |
| `401 Unauthorized` | Authentication missing or invalid. |
| `405 Method Not Allowed` | Folder does not exist, user has no edit rights, or root folder rename was attempted. |
| `500 Internal Server Error` | Unexpected server-side failure, such as DB/event processing error. |

Example:

```bash
curl -X POST 'https://api.files.fm/api_v2/rename_folder' \
  --data-urlencode 'folder_hash=YOUR_FOLDER_HASH' \
  --data-urlencode 'folder_name=New folder name' \
  --data-urlencode 'user=YOUR_USERNAME' \
  --data-urlencode 'pass=YOUR_PASSWORD'
```

## Supplemental Integration Sections

The remaining sections come from the same PDF and document related options: embedded e-signature forms, Files.fm AI endpoint usage, pre-built upload forms, embedding, previews, conversion, watermarking, and server-side AI analysis.

## 2. E-Signature API and Embedded Form Integration

The Files.fm e-signature form can be integrated into your system using JavaScript and embedded as an
iframe within your website or web application.

The embedded form communicates with your application through callback events, enabling seamless
interaction and status handling during the signing process. This allows users within your IT environment to
digitally sign files stored in Files.fm using supported electronic signature methods, including the Latvian State
Radio and Television Centre (LVRTC) e-signature and Smart-ID, when enabled for the corresponding business
account.

In addition to embedded usage, Files.fm also supports generating secure signing links that can be shared
with external parties. These links allow recipients to sign documents without requiring access to your
internal systems or a Files.fm user account, making the solution suitable for both internal workflows and
external document signing scenarios.

https://files.fm/api/demo/esigning_api_demo_v.2.0/

The integration example is written in the web programming language PHP and can be downloaded here:
https://files.fm/u/4dcrp5wy3

How to use the example:

1)     Download the file "esigning_api_demo_v.2.0.zip".
2)     Unzip this file and place it on your computer in web server's ( Apache + PHP ) folder.
3)     Open the config.php file and enter your Files.fm account username and password.
4)     Open the index.php file through your browser.

### 2.1. Initializing the Form

To initialize the e-signature form on the client side in the browser, on your page:

1) JavaScript resources must be included (for example, in the HTML head tag of the page):

```html
<script type="text/javascript" src="https://api.files.fm/esignature/form.js"></script>
```

2) You need to create a JavaScript object for the class FailiemLv_eSignature_Form , passing it the form
settings in the parameters. Parameters are optional.
objMyFailiemlvEsignatureForm = new FailiemlvEsignatureForm(
{
callbacks :
{
on_signing_finished : <function> ,
on_form_closed : <function>
},
emobile_signing :
{
open_new_tab : false
},
allowed_signing_formats :
{
edoc : true ,
pdf : true ,
asice : false
},
default_signing_format : "edoc" ,
signature_validation :
{
enabled : true
},
sign_files_separate :
{
allow_select : true ,
default : false
}
} );

#### Form settings parameters

Name                                            Data type         Require          Description
d
callbacks                                       object            No               An object with your JavaScript functions to be called after
specific events in the e-signature form.
callbacks.on_signing_finished                   function          No               Your function to be called when the user has finished
signing (see more Getting the signing result ).
callbacks.on_form_closed                        function          No               Your function to be called when the user has closed the
form (see more Receiving a form close event ).

emobile_signing                                 object            No               An object with settings for the eParaksts mobile signing
process.
emobile_signing.open_new_tab                    boolean           No               An indication of whether the eParaksts mobile signing
process should redirect to the eparaksts.lv system by
opening a new browser tab, or redirect to the existing
page.

allowed_signing_formats                         object            No               An object with allowed file signing formats.
allowed_signing_formats.edoc                    boolean           No               Flag whether to allow the user to sign files in "edoc"
format.
allowed_signing_formats.pdf                     boolean           No               Flag whether to allow the user to sign files in "pdf"
format.
allowed_signing_formats.asice                   boolean           No               Flag whether to allow the user to sign files in the "asice"
format.

default_signing_format                          string            No               Default signing format - "edoc", "pdf" or "asice".

signature_validation                            object            No               Object with settings for checking existing signatures in a
file.
signature_validation.enabled                    boolean           No               Flag whether to check and display existing signatures in
the file to be signed to the user when opening the form.

sign_files_separate                             object            No               Object with settings for signing multiple files - sign all in
one file or sign each in a separate file.
sign_files_separate.allow_select                boolean           No               Indicates whether to allow the user to choose the type of
multi-file signing.
sign_files_separate.default                     boolean           No               Default multi-file signing method. If set to "false", multiple
files will be signed all in one file. If set to "true", multiple
files will be signed each in a separate file.

### 2.2. Opening the Form

Before opening the form on the server side of the client system, the files to be signed must be uploaded
using the Files.fm data API.

If you need to sign multiple files :

1)      a new folder must be created (see Request for folder creation - create_folder );
2)      The files to be signed must be uploaded to the created folder (see Request for file upload - upload_file
).

If you need to sign a single file :

1) select an existing folder in your Files.fm account or create a new folder (see Request for folder creation
- create_folder ) to which to upload the file;
2) The file to be signed must be uploaded to the created or existing folder (see Request for file upload -
upload_file ).

The form can be opened by calling the showForm function on the previously created object of the class
FailiemLv_eSignature_Form .

If you need to sign multiple files , you must pass the folder details of the uploaded files to be signed to the
function in the parameters:
objMyFailiemlvEsignatureForm.showForm( folder_hash, folder_edit_key );

If you need to sign a single file , you must pass the data of the uploaded file to be signed to the function in
objMyFailiemlvEsignatureForm.showForm( null, null, file_hash, file_delete_key );

the parameters:

#### Function parameters

Name                                            Data type         Require          Description
d
folder_hash                                     string            No               Identifier of a folder in the Files.fm system. (Required if
signing multiple files.)
folder_edit_key                                 string            No               Key for repairing a folder in the Files.fm system. (Required
if signing multiple files.)
file_hash                                       string            No               Identifier of a file in the Files.fm system. (Required if
signing a single file.)
file_delete_key                                 string            No               A file repair key in the Files.fm system. (Required if signing
a single file.)

### 2.3. Receiving the Signing Result

As mentioned above, Initializing the Form , when initializing the form (creating a JavaScript object
of the form), you must specify a callback function on your page in the parameters , which should
be called when the signing process is complete ("on_signing_finished").
When calling this function, its first parameter will be passed an object with data about the signing result. The
signing can be successful or unsuccessful.

#### Signing result object data

Name                                                              Data            Description
type
success                                                           boolean         An indication of whether the signing was successful.
folder_hash                                                       string          The identifier of the folder of the files to be signed in the Files.fm
system.

Only returned if signing multiple files.
file_hash                                                         string          The identifier of the folder of the files to be signed in the Files.fm
system.

Only returned if signing a single file.
signed_file_format                                                string          The format or extension of the signed file.

Only returned if signing was successful.
signed_file_hash                                                  string          The identifier of the signed file in the Files.fm system.

It is returned only if:
- the signing has been successful,
- signs multiple files and the multiple file signing type is selected
as "all in one file",
- signs one file.
signed_file_delete_key                                            string          Signed file repair key in the Files.fm system.

It is returned only if:
- the signing has been successful,
- signs multiple files and the multiple file signing type is selected
as "all in one file",
- signs one file.
signed_file_hashes                                                array           An array with signed file data.

It is returned only if:
- the signing has been successful,
- signs multiple files and the multiple file signing type is selected
as "each file individually".
signed_file_hashes.original_file_name                             string          The name of the original file to be signed.
signed_file_hashes.signed_file_hashes                             string          The identifier of the signed file in the Files.fm system.
signed_file_hashes.signed_file_delete_key                         string          Signed file repair key in the Files.fm system.

Upon receiving a notification that the signing has been completed, if the signing has been successful, you
can download the signed files from the Files.fm system and save them to your system .

It is recommended to download the file on the server side of your system with an API request (see Request
for file download - download_file ).

After downloading the signed files, it is recommended to delete the previously uploaded file folder or file
from the Files.fm system by making a Delete API request from your system server . (see Request for deleting

a folder - delete_folder ). The folder or file identifier is passed in the function call parameter ("folder_hash",
"file_hash").

It is also recommended to delete the folder after an unsuccessful signing.

### 2.4. Receiving a form close event

As mentioned above , Initializing a Form , when initializing a form (creating a JavaScript
object of the form), you must specify a callback function on your page in the parameters
that should be called when the user closes the form (" on_form_closed ").
When calling this function, its first parameter will be passed an object with data about the file folder or file
opened in the form:

- if signing is performed for multiple files , an object with data about the folder opened in the form
will be submitted;
- If signing is performed for a single file , an object with data about the file opened in the form will be
passed.

#### File folders or file data opened in the form

Name                                                      Data type            Description
folder_hash                                               string               The identifier of the folder of the files to be signed
file_hash                                                 string               The identifier of the file to be signed in the Files.fm system.

Upon receiving a form closing notification, it is recommended to delete the previously uploaded file folder or
file from the Files.fm system via your system's server side with an API request (see Request to delete a folder
- delete_folder ). The folder or file identifier is passed in the function call parameter ("folder_hash",
"file_hash").

## 3. Files.fm AI API endpoint (Ollama compatible)

Files.fm AI API endpoint (Ollama-compatible) https://ai.files.fm

Overview

Files.fm AI provides a hosted Ollama-compatible Large Language Model API at https://ai.files.fm

The API is designed as a drop-in replacement for Ollama's HTTP interface, allowing existing tools, SDKs, and
automation platforms (like n8n workflows) to use Files.fm-hosted models without running local GPU
infrastructure and in a GDPR compliant way.

The API follows both - the standard Ollama /api/generate and /api/chat schema and semantics.

For automations, you might want use https://ai.files.fm/api/generate endpoint.

Generate your API keys here https://files.fm/account#api_keys

#### Supported Models

The following models are currently supported:

Model                            Purpose

gpt-oss:20b                      General-purpose text generation and reasoning

gemma3:latest                    Lightweight, fast instruction-following model

deepseek-ocr:latest OCR and text extraction from images

qwen3-vl:latest                  Vision-language model (image + text understanding)

Model aliases use the :latest tag to allow transparent backend upgrades. If you need other models, ask us.

#### Authentication

Authentication is performed using a user Bearer token passed via HTTP headers.

#### Header format

Authorization: Bearer UserID:RandomString

- UserID identifies the Files.fm user id (i.e. service account used for automation)

- RandomString is the API token (issued by Files.fm account manager or generated in user account
settings)

- Tokens must be kept confidential and stored securely.

- You might want to disable old tokens and generate new ones, if previous are lost.

### AI Endpoints

POST https://ai.files.fm/api/generate

POST https://ai.files.fm/api/chat

#### Headers

Content-Type: application/json
Authorization: Bearer UserID:RandomString

### Request Format (Ollama-Compatible)

The request body follows the standard Ollama chat format: https://docs.ollama.com/api/introduction

#### Common fields

Field            Description

model            Model name (see supported models above)

messages Chat messages array (role, content)

think            Reasoning level (low recommended for automation)

stream           Streaming mode (set false for most integrations)

/generate Example: gpt-oss:20b

curl --location 'https://ai.files.fm/api/generate' \

- -header 'Content-Type: application/json' \

- -header 'Authorization: Bearer UserID:RandomString' \

- -data '{

"model": "gpt-oss:20b",

"prompt": "What is Files.fm? Answer in one sentence.",

"think": "low",

"stream": false

}'

/chat Example:

curl --location 'https://ai.files.fm/api/chat' \

- -header 'Content-Type: application/json' \

- -header 'Authorization: Bearer UserID:RandomString' \

- -data '{

"model": "gpt-oss:20b",

"messages": [

{

"role": "user",

"content": "What is Files.fm? Answer in one sentence."

}

],

"think": "low",

"stream": false

}'

#### Example: gemma3:latest

curl --location 'https://ai.files.fm/api/chat' \

- -header 'Content-Type: application/json' \

- -header 'Authorization: Bearer UserID:RandomString' \

- -data '{

"model": "gemma3:latest",

"messages": [

{

"role": "user",

"content": "What is Files.fm? Answer in one sentence."

}

],

"stream": false

}'

### /generate Response Format

When stream is set to false, the API returns a JSON object. https://docs.ollama.com/api/generate

{ "response": "Generated text output from the model.", "done": true }

#### Response Fields

Field             Type                  Description

response string | object Generated output from the model

done              boolean               Indicates that generation has completed

### /chat Response Format

The response matches Ollama's standard structure.

#### Example

{

"message": {

"role": "assistant",

"content": "Files.fm is a secure cloud storage and file sharing platform for individuals and businesses."

}

}

The generated content is available at: message.content

#### Using Files.fm AI with n8n (Example Use Case)

#### Purpose

This example demonstrates how to use Files.fm AI inside n8n for automation tasks such as:

- Text summarization

- Classification

- OCR post-processing

- Internal AI assistants

- Document or form analysis

### Recommended Node: HTTP Request

Using the HTTP Request node provides maximum compatibility and control.

#### n8n Configuration

Method

POST

URL

https://ai.files.fm/api/generate

#### Headers

Name                   Value

Content-Type application/json

Authorization Bearer UserID:RandomString

Body Content Type

JSON

#### Body Example

{
"model": "gpt-oss:20b",
"prompt": "Summarize the following text in one concise sentence",
"think": "low",
"stream": false
}

#### Response

{
"response": "generated text"
}

### Extracting the AI Response in n8n

Use the following expression to access the generated output: {{$json.response}}

This value can be forwarded to:

- Email nodes

- Slack / Microsoft Teams

- Databases or CRMs

- Files.fm document workflows

- Webhooks or APIs

### n8n HTTP Request Setup Example

#### Operational Notes

- The API is stateless; no session handling is required

- Streaming is optional but not recommended for automation workflows

- Designed for server-side and backend use

- Suitable for GDPR-sensitive environments (EU-hosted)

#### Summary

- Files.fm AI is a fully Ollama-compatible hosted endpoint

- No local GPU, model downloads, or runtime management required

- Ideal for automation, integration, and backend AI workloads

## 4. Using a Pre-Built File Upload Form

For rapid and straightforward file upload integration, Files.fm provides a pre-built, configurable file upload
form that can be embedded into your website or application-similar in concept to the e-signature form.

This approach enables you to receive uploaded files quickly without implementing a full custom upload flow,
while still allowing configuration and customization per use case.

#### Key Capabilities

The pre-built upload form supports:

- Single-button or multi-step file uploads

- Custom input fields for collecting metadata alongside uploaded files

- Folder-based file organization

- Secure, link-based access control

- Seamless integration with existing Files.fm storage and workflows

#### Use Cases

The upload form is well suited for scenarios such as:

- Collecting files from external users or customers

- Receiving documents, images, or videos with structured metadata

- Rapid prototyping or low-code integrations

- Replacing custom upload implementations with a managed solution

The form can be configured to match your specific requirements, including the number of fields, validation
rules, and destination folders.

Learn more and configure your form: https://files.fm/upload-form

See an example in action: https://files.fm/demopro/?upload

## 5. Additional Resources and Examples

If you need further clarification, please reach out to support@files.fm.

You can access old Files.fm API V1 documentation and examples here: https://files.fm/api/

Note that not all details have been transferred to this document; however, you're free to use the existing V1
resources. The V2 format is preferred - feel free to request additional information or features as needed.

Basic file upload example: A raw code demonstrating how to use the API: https://files.fm/api/demo/

"Upload Form" upload process inspection: take a look, how file uploads work by inspecting the File Upload
Form (e.g., in Chrome DevTools): https://files.fm/upload_iframe.php?
uid=15802530&uid_hash=YOUR_UID_HASH

### 5.1. Example of embedding folder contents - gallery

```html
< iframe src="https://files.fm/u/cecguq8jzq&view=slideshow&autoplay=false" height ="315"
width ="100%" style =" max-width : 560px; border : 1px solid transparent;">< / iframe >
```

```html
<script type="text/javascript" src="https://files.fm/gallery_module/v1/js/?
hash=eax7jg9y3&user=13b73&ihash=c52baf6c80da1d00afe90a1eadaaef84&view=horizontal"
id="files_fm_upload_script_tag"></script>
```

### 5.2. DOC, Photo, Video, Audio File Conversion and Previews

Files.fm automatically generates previews and converted formats for a wide range of file types stored on the
platform. These previews enable fast viewing, embedding, and content inspection without downloading
original files. All preview generation is handled server-side within the Files.fm infrastructure.

### 5.2.1. Image Previews and Thumbnails

For image files (including RAW formats), Files.fm generates JPEG-based previews in multiple sizes.

#### Supported outputs

- Thumbnail (Small) - optimized for lists and galleries Example

- Preview (Normal) - resized image, typically up to ~1500 px on the longest edge Example

These previews are available for embedding and quick viewing while preserving the original file unchanged.

### 5.2.2. Document Previews

#### PDF Files

PDF documents can be previewed directly in the browser using the built-in PDF viewer, without requiring
downloads.

#### Office and Document Formats

Files.fm can generate PDF previews for common office and document formats, including but not limited to:

.doc, .docx, .odp, .ods, .odt, .pps, .ppsx, .ppt, .pptx,
.rtf, .xls, .xlsx, .dotx, .asice, .edoc, .zip

This allows documents to be viewed directly in the browser without requiring local software.

#### Text-Based Files

Text-based files can be previewed directly in the browser or downloaded as-is.

Supported formats include:
.txt, .php, .js, .html, .css, .xml, .csv, .ini, .log,
.asp, .asm, .c, .cc, .cmake, .cpp, .cs, .h, .java, .jsp,
.json, .pl, .py, .rb, .script, .sh, .swift, .sql, .vb,
.xhtml, .xsd, .xsl, .yaml, .yml, .inf

### 5.2.3. Video Previews and Streaming

For video files, Files.fm provides automatic preview and streaming support.

- If a video is not in MP4 format, or if the original MP4 exceeds supported bitrate thresholds, Files.fm
can generate a streaming-optimized MP4 preview

- Preview videos are suitable for in-browser playback and embedding

For large-scale or high-traffic video hosting, Files.fm recommends embedding videos using the Files.fm
JavaScript Video Player, which supports P2P-assisted streaming to optimize bandwidth usage and
performance.

### 5.3. Applying a Watermark

Files.fm supports applying text-based watermarks to image files in JPEG and PNG formats.

A watermark can be applied to an image by including the GET watermark_text parameter in the request
when doing save_file.php request: &watermark_text=YourTextHere

#### Automatic Watermarking

When a price is set or removed for an image or video file, Files.fm automatically regenerates file previews
(thumbnails). During this process, watermarks are applied automatically using the file owner's username.

This behavior ensures consistent branding and content protection for monetized or restricted-access media.

### 5.4. AI Image, Video, Audio and Text Analysis (Server-Side)

Files.fm provides server-side AI processing capabilities for images, videos, audio files and text content
stored on the platform. All analysis is performed within the Files.fm infrastructure-no client-side processing
or external AI services are required.

#### Supported AI Capabilities

Depending on your account type and configuration, the platform can perform:

- Optical Character Recognition (OCR) - extraction of text and numbers from images and video
frames

- Image and video content analysis - object detection, face detection, and scene understanding

- Automatic content description - AI-generated summaries and captions

- Auto-tagging and categorization - generation of searchable metadata

- Sentiment and emotion analysis - analysis of detected faces or textual content

- Text analysis using Large Language Models (LLMs) - summarization, classification, translation, and
semantic analysis of documents and text files

Processing Model

- All AI features operate asynchronous and server-side

- Results are stored as metadata associated with files and can be used for search, filtering,
moderation, or automation workflows

- No raw data is sent to third-party AI providers unless explicitly agreed

Availability

AI features are optional and may require:

- Specific account plans or add-ons

- Feature enablement by Files.fm

- Additional configuration depending on use case (e.g., face recognition, moderation, OCR pipelines)

For availability, configuration, or API-level access to these features, please contact support@files.fm .
