Files.fm API

Files.fm Cloud Storage API

Files.fm is a cloud storage platform with an HTTPS REST API (GET/POST), plus FTP/FTPS, WebDAV, and CalDAV/CardDAV calendar and address-book APIs. This document is the single source of truth for the Files.fm API. New integrations use the grouped /api/{group}/{operation} routes. Older script and /api_v2/ routes remain compatibility entry points where documented.

The content is verified against the canonical route registry api/_api_routes.php, its handlers, the compatibility scripts under api/, and the shared authenticator api/authenticate_user.php. Concrete access tokens and hashes in examples are placeholders.

For new integrations, use the grouped API. Compatibility scripts remain documented where no grouped equivalent exists yet.

REST API Overview

Base API host:

https://api.files.fm

Web links and the file browser use the base web host https://files.fm. Localized web subdomains are supported for share links, for example https://es.files.fm/u/{folder_hash} and https://de.files.fm/u/{folder_hash}.

Routing model

The API has one preferred URL style and two compatibility styles.

Style URL pattern Maps to Used by
Grouped API https://api.files.fm/api/{group}/{operation} canonical route registry and shared handlers New integrations
Compatibility action https://api.files.fm/api_v2/{action} compatibility dispatcher Existing integrations
Compatibility script https://api.files.fm/api/{script}.php api/{script}.php Existing integrations and features not migrated yet
Root-level script https://api.files.fm/{script}.php top-level script save_file.php, down.php, thumb*.php, ZIP streamer

Canonical read operations use GET; writes use POST. Bulk encryption-key reads use POST so their structured input stays in the request body. Successful responses are JSON unless the endpoint returns raw file content; compatibility scripts may return plain text.

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

Authorization

Authentication is handled centrally by api/authenticate_user.php, which is shared by the grouped API and compatibility endpoints. It accepts the following methods (checked in roughly this order). Any one of them is enough; always use HTTPS.

Method How to send credentials Notes
user + pass (GET) ?user=...&pass=... Username or email + password. Supported for compatibility; avoid putting secrets in URLs/logs.
user + pass (POST) POST fields user, pass Preferred over GET for credentials.
HTTP Basic authentication Authorization: Basic base64(user:pass) header Also read from the FastCGI Authorization header when PHP_AUTH_USER/PHP_AUTH_PW are not populated.
API access token user + user_access_token (GET or POST) Token for a user or dedicated service account. Generate/revoke at https://files.fm/account#api_keys. Recommended for automation.
Existing session cookie Standard PHPSESSID cookie from a prior login Supported by authenticated actions.
Session id parameter ?PHPSESSID=... or ?SessionID=... Use the session id without a cookie jar.
Google OAuth google_token + google_email (GET or POST) Verified ID token. First-time logins may auto-create an account (first_name, last_name optional).
Apple SSO apple_code (GET or POST) Authorization code exchanged with Apple; may auto-create an account on first login.

When authenticate_user.php is called as a standalone endpoint (no API_APP constant), it returns a JSON object:

{
  "Success": true,
  "Message": null,
  "SessionID": "PHPSESSID_VALUE"
}

Generating an API access token

Pass get_user_access_token to a successful login call (for example api/login.php or api/authenticate_user.php) to mint a token for the authenticated user; it is returned as UserData.user_access_token. Tokens can also be created and revoked in account settings at https://files.fm/account#api_keys. Keep tokens confidential and rotate them if leaked.

Two-factor authentication (2FA)

If the account requires 2FA, a successful credential check does not immediately grant a session. The API sends a confirmation link by email and waits briefly for the same IP to be confirmed:

Confirm the emailed link from the same IP, then retry the request. A token-based login for a service account bypasses the 2FA demand.

Security notes

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.
404 Not Found Route or requested encryption resource does not exist. Check the route and identifiers.
405 Method Not Allowed Requested operation is not permitted for this resource. Check file/folder hash and permissions.
409 Conflict Encryption state conflicts with the submitted epoch or immutable keys. Refresh the device bundle and retry with current state.
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

These are the canonical storage routes. All require authorization except file upload and download, which can also use a folder upload key or LINK access respectively.

Operation Method Endpoint Purpose
upload/create POST /api/upload/create Create a folder in ROOT or a parent folder.
file/upload POST multipart/form-data /api/file/upload Upload a file to an existing folder.
file/download GET /api/file/download Download raw file contents by file hash.
upload/delete POST /api/upload/delete Delete a folder.
file/delete POST /api/file/delete Delete a file.
upload/content GET /api/upload/content List files and subfolders in a folder.
sharing/received GET /api/sharing/received List sharing owners for the shared file tree.
sharing/apply_link_key POST /api/sharing/apply_link_key Apply a folder Edit or Add link key, or a file Edit link key, to the session.
file/move POST /api/file/move Move a file into another folder.
file/info GET /api/file/info Read file metadata.
upload/info GET /api/upload/info Read folder metadata.
file/rename POST /api/file/rename Rename a file.
upload/rename POST /api/upload/rename Rename a folder.
signing/list GET /api/signing/list List e-signatures for a file.
signing/share POST /api/signing/share Share a file for signing.
encryption/device_bundle GET, POST /api/encryption/device_bundle Read or update the account device bundle.
encryption/device_bundle_history GET /api/encryption/device_bundle_history Read an account's stored device lists by epoch.
encryption/file_keys GET, POST /api/encryption/file_keys Fetch or save per-device file keys.
encryption/folder_keys GET, POST /api/encryption/folder_keys Fetch or save per-device folder keys.
encryption/shared_file_key GET /api/encryption/shared_file_key Fetch a shared file key for the current device.
encryption/shared_folder_key GET /api/encryption/shared_folder_key Fetch a shared folder key for the current device.
encryption/device_keys/query POST /api/encryption/device_keys/query Fetch all accessible keys for a device.
encryption/device_keys POST /api/encryption/device_keys Save bulk keys for another account device.
encryption/device_link/request POST /api/encryption/device_link/request Create a device-link request.
encryption/device_link/receive POST /api/encryption/device_link/receive Receive a pending device-link request.
encryption/recovery_blob GET /api/encryption/recovery_blob Download the account's encrypted recovery blobs.
encryption/account_keys/rotate POST /api/encryption/account_keys/rotate Replace the account keys with the recovery key.
encryption/recovery_backfill/finish POST /api/encryption/recovery_backfill/finish Finish a recovery backfill and delete the old recovery blob.
encryption/reset GET, POST /api/encryption/reset Read or request an encryption reset.
encryption/reset/cancel POST /api/encryption/reset/cancel Cancel an open reset with a device signature.

Restore/undelete does not have a grouped route yet; use the compatibility scripts api/undelete_folder.php and api/undelete_file.php (see "Compatibility Endpoints").

The metadata/listing actions get_file_info, get_folder_info, and get_folder_content accept an optional get_access_rights flag that adds an access_rights object to each item (see those endpoints).

These three actions always return is_encrypted as an integer (0 or 1). They also accept split_root=true to enable the hash-addressed shared tree described below. Omit the flag, or send false, to retain the existing listing and parent-field behavior.

Quick Start

For new integrations, use the V2 storage quickstart, with token authentication in POST form fields. DVS uses a separate JSON API and tasks quickstart; MCP Bearer auth is not REST V2 auth.

V2 does not decode arbitrary JSON request bodies. Use application/x-www-form-urlencoded or multipart upload as documented. V2 errors can have an empty body; check HTTP status before parsing JSON. No universal REST request quota or idempotency-key contract is published. Reconcile uncertain writes before retrying.

A minimal create -> upload -> list -> download flow using the grouped API. These examples use HTTP Basic authentication; an API access token or session works too.

1. Create a folder

POST /api/upload/create
curl --user 'demo:demo' \
  --data-urlencode 'folder_name=my_folder_name' \
  --data-urlencode 'access_type=LINK' \
  'https://api.files.fm/api/upload/create'

The response includes the folder hash and its upload/edit keys. Store them for later calls.

{"folder_hash":"k7m2q9r4t6v8w3xy","folder_edit_key":"4f27a1d86c90be3571432aef69d8c504","folder_upload_key":"a93c520b7408ed16f25d69401b7ace38","folder_name":"my_folder_name","access_type":"LINK"}

Public folder link: https://files.fm/u/{folder_hash}. Public file link: https://files.fm/f/{file_hash}.

2. Upload a file

POST /api/file/upload
curl --user 'demo:demo' \
  -F 'folder_hash=k7m2q9r4t6v8w3xy' \
  -F 'file=@/tmp/local-file.txt' \
  'https://api.files.fm/api/file/upload'

Upload one file per request. The response includes file_hash, the stored name, timestamps, and the file delete key when the caller has edit rights.

3. List folder contents

curl --user 'demo:demo' \
  'https://api.files.fm/api/upload/content?folder_hash=k7m2q9r4t6v8w3xy'

4. Download a file

curl --user 'demo:demo' \
  'https://api.files.fm/api/file/download?file_hash=p4s7u2w9x3y6z8ab' \
  --output local-file.txt

5. Log in (session + ROOT keys)

GET|POST /api/login.php?user=demo&pass=demo

ROOT Folder and Account Info

Every account has a single ROOT folder: DisplayName = "ROOT", ParentID = 0. It is always private, cannot be renamed or deleted, and is the implicit parent when create_folder is called without parent_folder_hash.

To obtain the ROOT hash/keys and account details, authenticate and request user data. Calling api/authenticate_user.php (standalone, with any auth method) returns a UserData object. Add get_user_access_token to also mint an API token.

GET https://api.files.fm/api/authenticate_user.php?user=demo&pass=demo&get_user_access_token=1

UserData fields:

Field Description
ID User id.
UserName Username.
Email Account email.
first_name, last_name Account holder name.
avatar_path, profile_background Public profile assets.
root_upload_hash Hash of the ROOT folder.
root_upload_key ROOT folder delete/edit key.
root_add_key ROOT folder add-files key.
mobile_camera_upload_hash Hash of the mobile camera upload folder, if any.
current_location_country_code Lowercased country code derived from the request IP.
file_size_limit Per-file upload size limit (bytes) for the account.
queue_size_limit Upload queue size limit for the account.
user_access_token Present only when get_user_access_token was requested.

Note: the lightweight api/login.php endpoint returns the ROOT info as a plain-text cookie string (PHPSESSID, user, hash, ID, email, root_upload_hash, root_upload_key), not JSON. Use api/authenticate_user.php for the structured UserData object.

REST Endpoints

create_folder

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

POST https://api.files.fm/api/upload/create

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:

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

Success response:

{
  "folder_hash": "k7m2q9r4t6v8w3xy",
  "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 or null Key that grants permission to modify the folder. null when the caller has add but not edit rights on the parent folder (for example through an Add link).
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:

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.

POST https://api.files.fm/api/file/upload
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:

curl -X POST 'https://api.files.fm/api/file/upload' \
  -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:

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/file/upload' \
  -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:

{
  "file_hash": "p4s7u2w9x3y6z8ab",
  "file_delete_key": "70f25e31fa7963c4a2bb761e1f9d8095",
  "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 Opaque file edit/delete capability. Newly generated values contain 32 lowercase hexadecimal characters; preserve legacy shorter values unchanged.
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.

GET https://api.files.fm/api/file/download

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:

Public LINK example:

https://files.fm/f/demo

Compatibility endpoint, available but not recommended for new integrations:

https://api.files.fm/down.php?i=p4s7u2w9x3y6z8ab

Direct file path links may also be used where configured:

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.

POST https://api.files.fm/api/upload/delete

Authorization: required.

Parameters:

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

Response:

{"status":"ok"}

or:

{"status":"error"}

To restore a deleted folder, use the compatibility api/undelete_folder.php script (see "Compatibility Endpoints"). Undelete is available for PRO, BUSINESS, and ENTERPRISE accounts.

Errors: standard status codes from the REST overview.

delete_file

Deletes a file.

POST https://api.files.fm/api/file/delete

Authorization: required.

Parameters:

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

Response: no additional data documented.

To restore a deleted file, use the compatibility api/undelete_file.php script (see "Compatibility Endpoints"). Undelete is available for PRO, BUSINESS, and ENTERPRISE accounts.

Errors: standard status codes from the REST overview.

get_shared_with_me

Lists sharing owners for a separate Shared with me section. Requires authentication. No folder hash is required.

GET https://api.files.fm/api/sharing/received
get_access_rights=true

Returns an array with the same fields as split-root get_folder_content. Each entry is a virtual folder: name is the owner's username, hash is the owner's real ROOT folder hash, and parent_hash is null. Owners who share only individual files are included. Empty results are [].

To open an entry, call get_folder_content with its folder_hash and split_root=true. Keep this flag on subsequent folder-content, folder-info, and file-info requests. No panel identifier or path is required. Cache split-root responses separately from ordinary responses for the same hash.

Shared folders retain their full ancestor chain. Unshared ancestors are navigation-only: they expose only branches needed to reach active, confirmed shares. Their access_rights grants only allow_view; they do not grant access to unrelated content or file operations. A folder whose own sharing denies view stays navigable while an active share exists below it, so that a deeper override can still be reached; the folder itself lists nothing. Individually shared files appear directly under the owner's ROOT entry and retain their real file hashes. Entries with equal names remain distinct by hash.

A folder lists its files only when it grants download rights. A folder shared for viewing only returns its subfolders and no files, and get_file_info for a file inside it returns 405. Listed files inherit the folder's rights, with download implied. A file's own sharing row is then applied: an override row replaces the inherited rights, a plain row can only raise them. Directly shared files take their rights from the sharing row alone.

Split-root responses add is_virtual (boolean). For owner entries and navigation-only ancestors it is true; size, file_count, subfolder_count, and both timestamps are null. Their operation keys are omitted in listings and null in information responses. Storage metadata is masked: is_encrypted is 0, is_public, password_protected, and price_set are false, and expiry fields are null. is_virtual=false identifies real content metadata. An encrypted navigation-only ancestor therefore does not report its stored encryption flag.

In split-root mode, parent_hash and parent_folder_hash in information responses refer to the displayed, accessible tree parent, or null when unavailable. Directly shared files use the sharing owner's ROOT hash as their displayed parent. Existing download and mutation actions still use real hashes and their own authorization checks; tree navigation does not grant operation rights.

Split-root mode reproduces the WebDAV Shared with me tree, addressed by hash instead of by path. Access rights are the ones the platform's permission model returns, unchanged; sharing rows decide only what is listed and what is navigable.

Owner discovery accepts active, confirmed user and organization-user-group shares of an item that still exists, created by somebody else. Organization-admin shares and purchased files are excluded, as are shares assigned to an organization's external user groups, which WebDAV also does not discover; such a user can still open a shared folder by its hash. Enterprise subuser and organization special-folder sections are not included, and unlike WebDAV a shared organization special folder therefore stays visible inside the owner's entry.

Errors use the grouped API convention: 400 for invalid parameters, 401 without authentication, and 405 for missing or inaccessible items. split_root accepts boolean form values (true/false, 1/0); malformed values return 400.

get_folder_content

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

GET https://api.files.fm/api/upload/content

Authorization: required.

Parameters:

Name Type Required Description
folder_hash string Yes Folder hash whose contents should be listed.
split_root bool No Enable shared-tree navigation using real folder hashes. Default: false. Own ROOT contains only owned children in this mode; shared content has its separate get_shared_with_me section.
get_access_rights bool No When truthy, each item also includes an access_rights object (see below).

Response: JSON array of file/folder objects.

[
  {
    "type": "file",
    "hash": "p4s7u2w9x3y6z8ab",
    "name": "example.pdf",
    "size": 12345,
    "timestamp_uploaded": 1777638342,
    "timestamp_last_modified": 1777638342,
    "delete_key": "xxxxxx",
    "add_files_key": null
  },
  {
    "type": "folder",
    "hash": "c8d3f7h2j9k4m6np",
    "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.
access_rights object Only when get_access_rights is set. For folders: allow_view, allow_delete, allow_add, allow_edit, allow_download; when the listed folder is deletable, subfolders report allow_edit and allow_delete as true, as on the web. For files: allow_view, allow_delete, allow_edit, allow_download.
is_encrypted integer 0 or 1. Navigation-only entries return 0.
is_virtual bool Present only in split-root mode. True for shared-owner entries and navigation-only ancestor folders.
parent_hash string or null The folder being listed. Shared-owner entries have no parent folder.

Errors: standard status codes from the REST overview.

move_file

Moves a file into another folder in the same account.

POST https://api.files.fm/api/file/move

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.

GET https://api.files.fm/api/file/info

Authorization: required.

Parameters:

Name Type Required Description
file_hash string Yes File hash.
get_access_rights bool No When truthy, the response also includes an access_rights object (allow_view, allow_delete, allow_edit, allow_download).
split_root bool No Return the displayed shared-tree parent and is_virtual=false. Default: false.

Success response:

{
  "hash": "p4s7u2w9x3y6z8ab",
  "name": "example.pdf",
  "size": 12345,
  "timestamp_uploaded": 1777638342,
  "timestamp_last_modified": 1777638342,
  "delete_key": "xxxxxx",
  "parent_folder_hash": "c8d3f7h2j9k4m6np",
  "access_type": "LINK",
  "password_protected": false,
  "price_set": false
}

Response fields:

Name Type Description
hash string File hash.
is_encrypted integer Always returned: 0 or 1.
is_virtual bool Returned in split-root mode; always false for files.
parent_hash string or null In split-root mode, the displayed accessible parent. Individually shared files use the owner ROOT 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.
access_type string File access type (PRIVATE, LINK, PASSWORD, PUBLIC). If the file has no own access type, the parent folder's access type is returned.
password_protected boolean true when the parent folder has a password set (the password value is never returned).
price_set boolean true when the file has a download/sale price configured in file_download_price (the price amount is not returned).

Errors: standard status codes from the REST overview.

get_folder_info

Returns metadata for a folder.

GET https://api.files.fm/api/upload/info

Authorization: required.

Parameters:

Name Type Required Description
folder_hash string Yes Folder hash.
get_access_rights bool No When truthy, the response also includes an access_rights object (allow_view, allow_delete, allow_add, allow_edit, allow_download).
split_root bool No Permit navigation-only shared ancestors and return tree metadata. Default: false. See get_shared_with_me.

Success response:

{
  "hash": "k7m2q9r4t6v8w3xy",
  "name": "Folder name",
  "size": 12345,
  "timestamp_uploaded": 1777638342,
  "timestamp_last_modified": 1777638342,
  "delete_key": "xxxxxx",
  "parent_folder_hash": "c8d3f7h2j9k4m6np",
  "add_files_key": "zzzzz",
  "file_count": 10,
  "subfolder_count": 2,
  "access_type": "LINK",
  "password_protected": false,
  "price_set": false
}

Response fields:

Name Type Description
hash string Folder hash.
is_encrypted integer Always returned: 0 or 1. Virtual tree entries return 0.
is_virtual bool Returned in split-root mode. True for owner entries and navigation-only ancestors.
parent_hash string or null In split-root mode, the displayed accessible parent, or null.
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.
access_type string Folder access type (PRIVATE, LINK, PASSWORD, PUBLIC).
password_protected boolean true when the folder has a password set (the password value is never returned).
price_set boolean true when the folder has a download/sale price configured in file_download_price (the price amount is not returned).

Errors: standard status codes from the REST overview.

Applies the key from a folder Edit link (/u/{hash}?k={edit_key}), folder Add link (/u/{hash}?ak={upload_key}) or file Edit link (/f/{hash}?fk={edit_key}) to the caller's session, the same way opening the link in a browser does. Other V2 actions on that folder or file then use the granted rights: a folder edit key allows for example get_folder_content, rename_folder and delete_folder; an upload key allows upload_file and create_folder; a file edit key allows rename_file and delete_file.

POST https://api.files.fm/api/sharing/apply_link_key

Authorization: required.

Parameters:

Name Type Required Description
folder_hash string One of folder_hash/file_hash Folder hash from a /u/ link.
file_hash string One of folder_hash/file_hash File hash from a /f/ link. Only edit_key is accepted with it.
edit_key string Folder: one of edit_key/upload_key. File: yes Edit key (k or fk link parameter).
upload_key string One of edit_key/upload_key Add key (ak link parameter). Folders only.

Notes:

Success response:

{
  "hash": "k7m2q9r4t6v8w3xy",
  "name": "Folder name",
  "delete_key": "xxxxxx",
  "add_files_key": "zzzzz",
  "access_rights": {
    "allow_view": true,
    "allow_delete": true,
    "allow_add": true,
    "allow_edit": true,
    "allow_download": true
  }
}

Response fields:

Name Type Description
hash string Folder or file hash.
name string Folder or file name.
delete_key string or null Edit/delete key. null if the caller cannot delete the folder or file.
add_files_key string or null Upload/add key. null if the caller cannot add files. Folders only.
access_rights object Effective rights after applying the keys (allow_view, allow_delete, allow_add, allow_edit, allow_download; files have no allow_add).

Errors: 400 when no hash or key is given, both folder_hash and file_hash are given, or upload_key is sent with file_hash; 405 when the folder or file does not exist or a key is invalid.

get_esignatures

Returns e-signature records for a file.

GET https://api.files.fm/api/signing/list

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:

[
  {
    "file_hash": "p4s7u2w9x3y6z8ab",
    "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.

POST https://api.files.fm/api/signing/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:

{
  "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.

POST https://api.files.fm/api/file/rename

Authorization: required. Supported auth methods are the same as other grouped API operations, 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:

Success response:

{
  "file_hash": "p4s7u2w9x3y6z8ab",
  "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:

curl -X POST 'https://api.files.fm/api/file/rename' \
  --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.

POST https://api.files.fm/api/upload/rename

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:

Success response:

{
  "folder_hash": "k7m2q9r4t6v8w3xy",
  "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:

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

End-to-End Encryption Key Endpoints

These authenticated endpoints implement the current multi-device encryption protocol. The service stores public device bundles and wrapped item keys; plaintext content keys never reach the server. userID or accountId, where required, must identify the authenticated account.

Method and endpoint Required parameters Result
GET /api/encryption/device_bundle exactly one of userID, email { signedPayload, signature, epoch, signerDeviceID, deviceSignature, email } of the account's current device list, exactly as it was signed. signerDeviceID / deviceSignature are the sending device and its signature over the same bytes; null for lists saved before device signatures and for rotation and reset lists. email is returned for a lookup by email or for the caller's own userID; otherwise it is null. 404 means only that the account has no list history; a missing current list on an account that has history is 500.
GET /api/encryption/device_bundle_history accountID, fromEpoch, toEpoch { lists: [ { signedPayload, signature, epoch, signerDeviceID, deviceSignature } ] }: the account's stored lists, each exactly as it was signed, oldest first. The first item is fromEpoch and the rest follow with no gaps; at most 50 per call, so the client asks again from the next epoch until it reaches toEpoch. Rotation and reset lists are included with signerDeviceID / deviceSignature null. Any signed-in user can read any account, like GET device_bundle. 400 BAD_RANGE when fromEpoch < 1, toEpoch < fromEpoch or a value is not an integer (BAD_PAYLOAD for a bad accountID); 404 NOT_FOUND when the account has no list history or toEpoch is above its current epoch; 500 (HISTORY_GAP) when a list inside the range is missing from storage.
POST /api/encryption/device_bundle signedPayload, signature, deviceSignature (optional signerDeviceID, must match the payload); first list also recoveryBlob; update expectedEpoch (and recoveryBlob when the recovery device changes) First list (no expectedEpoch) or normal update. See Account recovery. Returns { success, epoch }.
POST /api/encryption/device_link/request userID, secret, version, deviceID, requestFingerprint, expiresAt, publicKeys Creates or replaces the pending link request for a new device.
POST /api/encryption/device_link/receive userID, deviceID Returns the pending link request addressed to the device.
POST /api/encryption/file_keys fileHash, signerDeviceID, keysByDevice Saves a wrapped key for every registered recipient device and marks the file encrypted.
POST /api/encryption/folder_keys uploadHash, signerDeviceID, keysByDevice Saves a wrapped key for every registered recipient device and marks the folder encrypted.
GET /api/encryption/file_keys userID, fileHash, deviceID; optional isEncryptedFolder Returns the current device's wrapped file key, signer identity, and signer device bundle.
GET /api/encryption/folder_keys userID, uploadHash, deviceID; optional isEncryptedFolder Returns the current device's wrapped folder key, signer identity, and signer device bundle.
GET /api/encryption/shared_file_key userID, fileHash, receiverEmail, deviceID Returns the caller's file key and the recipient device bundle for re-wrapping. senderDeviceListBundle belongs to the owner of signerDeviceID (the original sharer on a re-share), so it verifies keySignature.
GET /api/encryption/shared_folder_key userID, uploadHash, receiverEmail, deviceID Returns the caller's folder key and the recipient device bundle for re-wrapping. senderDeviceListBundle belongs to the owner of signerDeviceID (the original sharer on a re-share), so it verifies keySignature.
POST /api/encryption/device_keys/query userID, deviceID; optional limit (1-1000, default 500 when paging), cursor Returns every accessible file and folder key wrapped for the device, grouped with signer bundles. deviceID may be a revoked device of the account (the backfill reads the old recovery device's keys). Paging is opt-in: send limit and/or cursor and pass the returned nextCursor back as cursor until it is null; without them everything is returned at once.
POST /api/encryption/device_keys userID, signerDeviceID, targetDeviceID, and at least one of files, uploads; optional sourceDeviceID Saves batches of existing item keys for another device owned by the account. With sourceDeviceID (an own device, a revoked one allowed) the keys held by that device are re-wrapped by the signing device - the recovery backfill.

keysByDevice, publicKeys, files, and uploads are structured form values matching the objects accepted by the handlers. Missing fields return 400; account or permission mismatches return 403; missing resources return 404; stale epochs and immutable-key conflicts return 409. Successful write operations return { "success": true } or saved-item counts as documented by their response fields.

Account recovery: device lists, rotation and reset

The server accepts a new device list only when a key the account already trusts signed it. It checks public keys only and never sees a private key or the recovery secret. The previous list and its keys are always read from the database, never from the request.

Signed payloads. The client sends the exact bytes it signed: signedPayload (base64 of UTF-8 JSON) and signature (base64 of the hybrid signature). The server verifies the signature over the decoded bytes, parses the same bytes, stores them unchanged and returns them unchanged; other form fields are ignored. JSON with duplicate keys, wrong types, missing or extra fields, non-canonical base64 or wrong key sizes is BAD_PAYLOAD. Limits: payload 1 MB, recovery blob 64 KB (decoded), 500 device rows.

Hybrid signature: u32be(len(mldsa_sig)) || u32be(len(ed25519_sig)) || mldsa_sig || ed25519_sig - ML-DSA-65 (3309 bytes, FIPS 204, pure mode, empty context) and Ed25519 (64 bytes). Both parts must verify.

Device list payload (info is files.fm device-list, protocolVersion is 1, accountId is a decimal string, device ids are lowercase hex fingerprints):

{
  "info": "files.fm device-list",
  "protocolVersion": 1,
  "epoch": 7,
  "accountId": "123456",
  "accountPublicDSAKey": "<base64, 1952 bytes>",
  "accountPublicEd25519Key": "<base64, 32 bytes>",
  "recoveryDeviceId": "<hex>",
  "signerDeviceId": "<hex, the sending device>",
  "deviceList": {
    "<deviceId hex>": {
      "publicKEMKey": "<base64, 1184 bytes>",
      "publicDSAKey": "<base64, 1952 bytes>",
      "publicX25519Key": "<base64, 32 bytes>",
      "publicEd25519Key": "<base64, 32 bytes>",
      "revoked": false,
      "primary": true
    }
  }
}

signerDeviceId is required in lists sent to POST /api/encryption/device_bundle and optional elsewhere; when a rotation or reset list names it, it must be an active primary row of that list. Lists stored before device signatures have none.

Device signature. deviceSignature is a hybrid signature over the same decoded signedPayload bytes, made with the keys of the signerDeviceId row. A revoked primary device still holds the account key, so the account signature alone does not authorize a write.

Rotation statement (statementPayload + statementSignature, signed by the recovery device):

{ "info": "files.fm account-rotation v1", "accountId": "123456", "recoveryDeviceId": "<hex, the signer>", "newEpoch": 8,
  "newAccountPublicDSAKey": "<base64>", "newAccountPublicEd25519Key": "<base64>" }

Backfill-done (signedPayload + signature, signed by an active primary device):

{ "info": "files.fm recovery-backfill-done v1", "accountId": "123456", "deviceId": "<hex, the signer>", "oldRecoveryDeviceId": "<hex>", "epoch": 8 }

Reset cancel (signedPayload + signature, signed by an active device that is not the recovery row; resetId is the id returned by the reset request):

{ "info": "files.fm reset-cancel v1", "accountId": "123456", "deviceId": "<hex, the signer>", "resetId": "<32 hex>" }
Endpoint Parameters Rules
POST /api/encryption/device_bundle, first list signedPayload, signature, deviceSignature, recoveryBlob No expectedEpoch. LIST_EXISTS when any history exists. Epoch 1, signed by the account keys it names, and by the signer row of the request list, which must be active and primary (SIGNER_NOT_ACTIVE otherwise), exactly two active rows: one primary device and the recovery row (not primary). The blob is stored as the active one. The owner is emailed.
POST /api/encryption/device_bundle, update expectedEpoch, signedPayload, signature, deviceSignature, recoveryBlob only if the recovery device changes EPOCH_CONFLICT unless expectedEpoch is current; epoch is current + 1. The account keys must equal the stored ones (USE_ROTATION otherwise). The signer row must be active in the stored list (SIGNER_NOT_ACTIVE otherwise; it need not be primary yet, for a promotion) and deviceSignature must verify with its stored keys; the stored account key must have signed the list. Every old row stays with the same keys, no revoked row becomes active, at least one active primary device remains. The recovery row stays active and not primary; a new recovery device must be a new row, with the old one revoked and a new blob sent. An open reset is cancelled.
GET /api/encryption/recovery_blob - 10 requests per account per day. Returns { blobs: [ { recoveryDeviceId, status, recoveryBlob } ] } for the active blob and any backfill blobs. Audited and emailed.
POST /api/encryption/account_keys/rotate expectedEpoch, listPayload, listSignature, statementPayload, statementSignature, recoveryBlob (the new one) 5 attempts per account per day. The statement must be signed by the recovery device that is active in the stored list (RECOVERY_REVOKED if it is revoked, BAD_STATEMENT if another id). The new list carries the statement's account keys, is signed by them, revokes every old row and brings an active primary device and a new active recovery row. The old blob becomes a backfill blob, the new one active. An open reset is cancelled, all other sessions end, the owner is emailed.
POST /api/encryption/recovery_backfill/finish signedPayload, signature (backfill-done) The signer must be an active primary device of the current list (BAD_SIGNATURE otherwise) and the named blob must have status backfill. The blob is deleted. A session alone cannot delete it.
POST /api/encryption/reset baseEpoch, signedPayload, signature (a list as in a rotation, without a statement), recoveryBlob For a user with no devices and no recovery secret. 5 requests per account per day. RESET_PENDING if one is open, EPOCH_CONFLICT unless baseEpoch is current. Stored as pending; the current list is not changed. The owner is emailed a confirm and a cancel link. Returns { resetId, status, applyAfter }. The reset is applied by a scheduled job after 7 days (applyAfter) only if it was confirmed, not cancelled and the current epoch is still baseEpoch; an unconfirmed one expires. Old wrapped keys and encrypted data are left untouched.
GET /api/encryption/reset - { reset: { resetId, status, baseEpoch, requestedAt, applyAfter } }, or { reset: null }.
POST /api/encryption/reset/cancel signedPayload, signature (reset-cancel) Cancels the open reset named by resetId.

Wrapped keys. A key can only be uploaded for a device that is active in the current list. Keys wrapped to a device can be read by the account's own session also when that device is revoked.

Error codes. Refusals of these endpoints carry a body { "error": "<CODE>" } (every other endpoint answers errors with an empty body):

Code HTTP Meaning
LIST_EXISTS 409 First list sent, but history exists. Do not make new account keys.
EPOCH_CONFLICT 409 expectedEpoch / baseEpoch is not current, or a concurrent write won. Load the list again and retry.
RESET_PENDING 409 A reset is already open.
USE_ROTATION 400 Normal update with changed account keys.
BAD_STATEMENT 400 A statement field does not match.
BAD_ROWS 400 A row is missing, changed or un-revoked, or the required rows are missing.
BAD_PAYLOAD 400 Parse error, duplicate key, wrong version or type, or too large.
RECOVERY_REVOKED 403 The recovery device is revoked in the stored list.
SIGNER_NOT_ACTIVE 403 The sending device is not an active row of the stored list (for a first list: not an active primary row of the request). Link the device again.
BAD_SIGNATURE 403 A list, device, statement or payload signature does not verify.
RATE_LIMITED 429 Too many attempts.

Every device bundle in a response (deviceListBundle, senderDeviceListBundle, receiverDeviceListBundle, deviceListBundles[userId]) has the shape { signedPayload, signature, epoch, signerDeviceID, deviceSignature, email }; email is outside the signed data, is not covered by signature, and is for display only.

Compatibility Endpoints

These script endpoints predate the grouped API. They remain available because current integrations still use them and many have no grouped equivalent yet (thumbnails, recursive tree, ZIP download, versions, sharing, embedding). They live under https://api.files.fm/api/{script}.php (or at the root for save_file.php, down.php, thumb*.php). All authenticate through api/authenticate_user.php, so any auth method from the Authorization section works. Most return JSON; a few return plain text (noted per endpoint).

Authentication and session compatibility

login.php

GET|POST https://api.files.fm/api/login.php?user=demo&pass=demo

Logs the user in and returns a plain-text cookie string with the session and ROOT folder info:

cookie:PHPSESSID=...; user=demo; hash=...; ID=11315; email=demo@example.com; root_upload_hash=...; root_upload_key=...

Returns error: incorrect login on failure. For a structured JSON UserData object (and to mint an API token), call api/authenticate_user.php instead (see "ROOT Folder and Account Info").

sesslogin.php

GET|POST https://api.files.fm/api/sesslogin.php?PHPSESSID=...&username=demo&redirect_url=https://files.fm/filebrowser

Cross-domain web login helper: validates the session and redirect_url (must be a failiem.lv/files.fm/files.me/file.fm host), logs the user in on the current and partner domains, then issues an HTTP redirect. Intended for browser SSO flows, not REST clients.

validate_session.php

GET https://api.files.fm/api/validate_session.php

Returns whether the current session is logged in:

{"Success": true, "Message": null, "SessionID": "..."}

test_session.php

GET https://api.files.fm/api/test_session.php

Prints the _COOKIE and _SESSION arrays. Used only for internal development/diagnostics. NA.

Folder creation and key compatibility

get_upload_id.php (create folder)

GET https://api.files.fm/api/get_upload_id.php

Creates a folder and returns its hash and keys. This is the compatibility backend behind POST /api/upload/create.

Parameters: user, pass (optional), folder_name (optional), parent_hash (optional, defaults to ROOT when authenticated), access_type (PRIVATE or LINK).

https://api.files.fm/api/get_upload_id.php?user=demo&pass=demo&folder_name=My_Folder&parent_hash=k7m2q9r4t6v8w3xy
{"hash":"c8d3f7h2j9k4m6np","delete_key":"4f27a1d86c90be3571432aef69d8c504","add_key":"a93c520b7408ed16f25d69401b7ace38","UserID":44961,"FolderName":"my_foldername"}

If used anonymously, UserID may be false, and the anonymous folder is auto-deleted after about one month.

get_upload_keys.php

GET https://api.files.fm/api/get_upload_keys.php?hash=k7m2q9r4t6v8w3xy&user=demo&pass=demo

Returns the folder's add and delete keys:

{"AddFileKey":"a93c520b7408ed16f25d69401b7ace38","DeleteKey":"4f27a1d86c90be3571432aef69d8c504"}

get_add_key.php

GET https://api.files.fm/api/get_add_key.php?hash=k7m2q9r4t6v8w3xy

Requires an active user session. Returns only the folder add key:

{"add_key":"a93c520b7408ed16f25d69401b7ace38"}

get_file_keys.php

GET https://api.files.fm/api/get_file_keys.php

Returns file edit keys (a folder edit key also works where supported). Contact Files.fm for full documentation and enabled access.

get_ids_and_keys_from_paths.php

POST https://api.files.fm/api/get_ids_and_keys_from_paths.php?upload_hash={parent_hash}&add_key={parent_add_key}

Resolves a list of directory paths under a parent folder to their ids and add keys, creating any missing folders. POST Directories[] entries (one path per entry). Optional access_type (PRIVATE, LINK, PASSWORD, PUBLIC) and addto/addhash for public-upload contexts.

{
  "Success": true,
  "Directories": {
    "/test": {"id": 123, "add_key": "a93c520b7408ed16f25d69401b7ace38"},
    "/test/sub1": {"id": 234, "add_key": "c016a72f8395bd40e17846ca53f29ed7"}
  },
  "Error": null
}

File upload and replacement compatibility

save_file.php (upload)

POST https://api.files.fm/save_file.php?up_id={folder_hash}&key={add_key}&get_file_hash

Uploads one file (multipart field file). This is the compatibility backend behind POST /api/file/upload. With get_file_hash, returns the new file hash. Optional watermark_text (and related watermark params) for image uploads. Upload one file per request.

curl -i -F 'file=@/tmp/local-file.txt' 'https://api.files.fm/save_file.php?up_id=k7m2q9r4t6v8w3xy&key=a93c520b7408ed16f25d69401b7ace38&get_file_hash'

save_file.php (replace)

POST https://api.files.fm/save_file.php?up_id={folder_hash}&key={add_key}

Pass do=update and replace_file_hash={file_hash} to replace an existing file. Supports file versions for BUSINESS and ENTERPRISE accounts; the ETag changes after replacement. Contact Files.fm for the full replacement flow.

For conditional replacement, include the multipart field expected_etag with the last accepted ETag (without surrounding quotes). The storage server checks it while holding the per-file replacement lock, before changing the content. A stale ETag returns conflict code 409; an empty or non-string value returns 400. Omitting the field preserves unconditional replacement for existing clients. API version 2 successful upload responses also include data.etag, the revision written by that request. Keep this returned revision for the next conditional save.

Listing and metadata compatibility

get_file_list_for_upload.php (List folder child items)

GET https://api.files.fm/api/get_file_list_for_upload.php?hash={folder_hash}&include_folders=1

Returns direct child files/folders and metadata for one folder (not recursive). This is the compatibility backend behind GET /api/upload/content.

[{"hash":"p4s7u2w9x3y6z8ab","name":"File1.jpg","Size":"106361"},{"hash":"q2r5t8v3w7x4y9za","name":"File2.jpg","Size":"62249"}]

Empty folder returns [].

Anonymous link access. This compatibility endpoint also accepts unauthenticated requests for folders whose access type is LINK or PUBLIC: pass only the folder hash (no credentials). The listing is strictly view-only — delete_key/add_key are never returned, PRIVATE folders and password-protected folders (without a session password) are rejected, and PRIVATE files inside a public folder are filtered out. To deter automated enumeration, anonymous requests are rate-limited per IP (HTTP 429 / {"error":"rate_limited"} when exceeded) and intentionally delayed by ~2 seconds each. Authenticated requests (session, user+pass, or user+user_access_token) are not throttled or delayed. The grouped GET /api/upload/content operation always requires authentication.

GET https://api.files.fm/api/get_upload_tree.php?Hash={folder_hash}&DeleteKey={folder_delete_key}

Returns all subdirectories and their contents recursively, with file/folder metadata. Also used as the basis for folder search.

{
  "error": null,
  "data": {
    "Type": "Folder", "ID": "4759592", "Hash": "k7m2q9r4t6v8w3xy",
    "AddFileKey": "a93c520b7408ed16f25d69401b7ace38", "DeleteKey": "4f27a1d86c90be3571432aef69d8c504", "ParentID": "4962316",
    "CreatedDate": "2014-02-20 22:55:30", "ModifiedDate": null, "Name": "Example folder",
    "Children": [
      {"Type": "Folder", "ID": "4799549", "Hash": "c8d3f7h2j9k4m6np", "AddFileKey": "c016a72f8395bd40e17846ca53f29ed7", "DeleteKey": "e2836407b5ad19fc83617e20a94d52cb", "ParentID": "4759592", "CreatedDate": "2014-03-01 18:50:13", "ModifiedDate": null, "Name": "Child folder", "Children": false}
    ]
  }
}

upload_list.php (ROOT children)

GET https://api.files.fm/api/upload_list.php?user=demo&pass=demo

Returns the direct children of the user's ROOT folder (metadata only, no add/delete keys): hash, date, description, files, size, views, valid_to_date.

[{"hash":"k7m2q9r4t6v8w3xy","date":"2012-12-05 19:00:19","description":"","files":"2","size":"168610","views":"1","valid_to_date":""}]

get_file_info.php

Two modes:

GET  https://api.files.fm/api/get_file_info.php?hash={file_hash}&del_key={file_delete_key}
POST https://api.files.fm/api/get_file_info.php   (action=get_file_hash_by_name)

The GET mode returns rich file metadata (requires the file's delete key):

{"success": true, "file_info": {"Name": "photo.jpg", "ContentType": "image/jpeg", "Extension": "jpg", "ExtensionType": "image", "Size": "106361", "RealSize": 106361, "CustomInfo": {"Width": 1024, "Height": 768}}}

The POST mode (action=get_file_hash_by_name, upload_hash, file_name; requires a logged-in user with view rights) resolves a file name to its hash:

{"success": true, "file_info": {"hash": "p4s7u2w9x3y6z8ab"}}

get_uploads_exist.php

POST https://api.files.fm/api/get_uploads_exist.php

Authenticated. POST a JSON body {"hashes": ["...","..."]} and receive a map of folder hash to existence (only folders owned by the user with an add key count as existing):

{"k7m2q9r4t6v8w3xy": true, "c8d3f7h2j9k4m6np": true, "b6c9d2f5h8j3k7mn": false}

get_storage_data.php

GET https://api.files.fm/api/get_storage_data.php

Authenticated. Returns the signed-in user's storage usage and quota (MB):

{"success": true, "message": null, "data": {"used_mb": 5.39, "quota_mb": "2000", "available_mb": "2000", "free_mb": 1994.61}}

Search (web/ajax)

ajax/search.php

GET|POST https://files.fm/ajax/search.php

Full-text search across the authenticated user's files and folders (own, shared, in a specific folder, and optionally deleted items). Served from the files.fm web host and authenticated by session, so pass PHPSESSID as a cookie or query parameter. Storage subscribers are searched via the Sphinx full-text index; other accounts fall back to a SQL LIKE search. Two request styles are supported.

  1. Simplified API mode (recommended for integrations). Pass result_format=JSON and query; the script builds the search definition and returns a clean JSON array. Optionally pass folder_hash to restrict the search to one folder (subfolders included). When folder_hash is omitted or set to ROOT, it searches your own files plus organization-shared files.
GET https://files.fm/ajax/search.php?result_format=JSON&query=document&PHPSESSID=YOUR_SESSION_ID
  1. Full mode (used by the file browser UI). Pass a URL-encoded search_json object plus table paging/sorting parameters.
GET https://files.fm/ajax/search.php?search_json=%7B...%7D&PHPSESSID=...&table_page=0&table_size=1000&table_column[3]=1

The decoded search_json from the file-browser example:

{
  "Mode": "simple",
  "Query": "document",
  "Types": {},
  "Sections": { "MY": true, "SHARED_WITH_ME": true, "DELETED": false, "THIS_FOLDER": false },
  "ThisFolder": ""
}

search_json fields:

Field Type Required Description
Mode string Yes simple or advanced.
Query string Yes (simple) Search phrase, minimum 2 characters.
Types object Yes (simple) Type filter. Keys: DOCUMENTS, IMAGES, VIDEO, MUSIC, FOLDERS, FILES (booleans). Empty {} searches all types.
Sections object Yes Where to search. Keys: MY, SHARED_WITH_ME, SHARED_WITH_ME_ONLY_ORGANIZATION, DELETED, THIS_FOLDER (booleans). At least one must be true. DELETED is ignored unless the user is a storage subscriber.
ThisFolder string Conditional Folder hash to search in. Required when Sections.THIS_FOLDER is true.
Operator string Yes (advanced) AND or OR.
Criteria array Yes (advanced) Advanced criteria, each { Field, Operator, Query, AdditionalParam }. Contact Files.fm for the full field/operator list.

Other query parameters:

Name Type Description
result_format string JSON (clean array, recommended), OWNCLOUD (Nextcloud/ownCloud unified-search structure), or omitted for WEB_TABLESORTER (pre-rendered HTML rows used by the web UI).
query string Simplified-mode search phrase (alternative to search_json).
folder_hash string Simplified-mode folder restriction.
table_size integer Results per page, 1-1000 (default 1000).
table_page integer Zero-based page number.
table_column[<index>] integer Sort column and direction (0 = ascending, otherwise descending). Index: 2 = name, 4 = size, 5 = owner, 6 = views; other indexes sort by modification date.
NoSubfolders bool Do not search subfolders.
get_access_rights bool With result_format=JSON or result_format=OWNCLOUD, add an access_rights object to each item. Rights match the folder listing: folders also get allow_add, and a folder whose parent the caller may delete is editable and deletable. With result_format=JSON, folders another user owns that the caller may delete also get delete_key, to apply with apply_link_key before rename_folder or delete_folder.
PHPSESSID string Session id (if not sent as a cookie).

result_format=JSON response: a JSON array of result items.

[
  {
    "type": "file",
    "name": "document.pdf",
    "hash": "p4s7u2w9x3y6z8ab",
    "is_encrypted": 0,
    "size": 12345,
    "mod_date": "2026-05-01 12:00:00",
    "path": "/folder/sub/document.pdf",
    "public_access_type": "PRIVATE",
    "parent_hash": "k7m2q9r4t6v8w3xy",
    "content_type": "application/pdf",
    "file_count": null,
    "subfolder_count": null,
    "access_rights": null
  }
]

Response fields (result_format=JSON):

Name Type Description
type string file or folder.
name string File or folder name.
hash string File or folder hash.
is_encrypted integer Always returned: 0 or 1.
size integer Size in bytes.
mod_date string Last modification datetime.
path string Full path of the item.
public_access_type string PUBLIC (LINK/PUBLIC) or PRIVATE.
parent_hash string Parent folder hash.
content_type string or null MIME type for files; null for folders.
file_count integer or null File count for folders; null for files.
subfolder_count integer or null Subfolder count for folders; null for files.
access_rights object or null Present only with get_access_rights. For folders: allow_view, allow_delete, allow_add, allow_edit, allow_download. For files: allow_view, allow_delete, allow_edit, allow_download.

result_format=OWNCLOUD entries carry the same two fields beside the Nextcloud unified-search keys: is_encrypted (integer) and access_rights (object or null, present only with get_access_rights).

The default WEB_TABLESORTER response is an object { "status": "ok", "total_rows": N, "headers": [...], "rows": [...], "page_count": N, "total_time": 0.12 } where rows contain pre-rendered HTML for the web UI. Errors return { "status": "error" }.

Rename and access-type compatibility

change_file.php (rename file)

GET|POST https://api.files.fm/api/change_file.php?file_hash={file_hash}&folder_hash={folder_hash}&file_display_name=NewName.txt

Updates a file's display name.

{"Success":true,"Error":null,"Message":"Fields updated"}

change_upload.php (rename folder)

GET|POST https://api.files.fm/api/change_upload.php?Hash={folder_hash}&upload_display_name=New%20Name

Authenticated; requires edit rights. Renames a folder (DisplayName). The ROOT folder cannot be renamed. You may pass UploadID instead of Hash.

{"Success":true,"Error":null,"Message":null}

upload_access_type.php (change folder access type)

GET https://api.files.fm/api/upload_access_type.php?h={folder_hash}&type=PRIVATE

Authenticated; requires permission. type is one of PRIVATE, PASSWORD, LINK, PUBLIC.

{"success": true, "error": ""}

Delete and restore compatibility

delete_file.php

GET|POST https://api.files.fm/api/delete_file.php?hash={file_hash}&del_key={delete_key}

Deletes a file by hash and delete key (the key may be the parent folder delete key or the file's own key). This is the compatibility backend behind POST /api/file/delete.

{"success":1}

Failure returns {"success":0}. Legacy combined endpoint: GET https://api.files.fm/list.php?i={folder_hash}&k={delete_key}&f={file_hash}.

delete_upload.php (delete folder)

GET|POST https://api.files.fm/api/delete_upload.php?u={folder_hash}&del_key={delete_key}

Deletes a folder (and its files/subfolders) owned by the authenticated user. This is the compatibility backend behind POST /api/upload/delete. Optional delete_only_subfolders=1 deletes only the subfolders (sent as a query parameter; it is the one parameter here that is not read from POST). The response is always JSON; the jsonp/callback wrapper this endpoint used to accept was removed after access logs showed no callers.

{"success":1,"error":0,"deleted_id":1234}

Failure returns {"success":0,"error":1,"deleted_id":null}. Legacy combined endpoint: GET https://api.files.fm/list.php?i={folder_hash}&k={delete_key}&t=ok.

multi_delete.php

POST https://api.files.fm/api/multi_delete.php

Authenticated. Deletes many files and folders in one transaction. POST JSON {"items": {"files": ["..."], "folders": ["..."]}}, up to 200 items per call. Rolls back if any item fails or the user lacks delete rights.

{"success": true, "error": "", "error_code": null}

undelete_file.php

GET|POST https://api.files.fm/api/undelete_file.php?hash={file_hash}

Restores a deleted file. Requires a logged-in paying user (storage subscriber). Optional return_new_path=true and return_new_folder_id=true add path/folder info to the response.

{"status":"ok"}

undelete_folder.php

GET|POST https://api.files.fm/api/undelete_folder.php?hash={folder_hash}

Restores a deleted folder (and its recoverable files). Requires a logged-in paying user. Optional return_new_path=true. Returns {"status":"ok"} or {"status":"error"}. Undelete is available for PRO, BUSINESS, and ENTERPRISE accounts; the restoration window depends on account type.

multi_restore.php

POST https://api.files.fm/api/multi_restore.php

Authenticated. Restores many deleted files/folders owned by the user. POST JSON {"items": {"files": ["..."], "folders": ["..."]}}, up to 200 items per call.

{"success": true, "error": "", "error_code": null}

delete_items_from_recyclebin.php (permanent delete)

POST https://api.files.fm/api/delete_items_from_recyclebin.php

Permanently deletes items from the recycle bin. Authenticated; requires the account password for confirmation. POST password and items = {"files": ["..."], "folders": ["..."]}.

{"status":"ok"}

Incorrect password returns {"status":"error","error_code":1}. This is destructive and not recoverable.

restore_version_file.php (file versions)

GET https://api.files.fm/api/restore_version_file.php?hash={file_hash}&del_key={delete_key}&version_id={version_id}

Restores a previous version of a file as the current version. Requires a logged-in user. File versions are a BUSINESS/ENTERPRISE feature.

Download, thumbnail, and preview compatibility

down.php (download)

GET https://api.files.fm/down.php?i={file_hash}

Downloads a file by hash. This is the compatibility backend behind GET /api/file/download. Direct download limits depend on account type and security settings.

thumb.php (small thumbnail)

GET https://api.files.fm/thumb.php?i={file_hash}

Small image thumbnail, approximately 400x271 px.

Large thumbnails

GET https://api.files.fm/thumb_show.php?i={file_or_folder_hash}
GET https://api.files.fm/thumb_video_picture.php?i={file_hash}
GET https://api.files.fm/thumb_folder.php?i={folder_hash}

Large thumbnails (approximately 1500 px) for images, video poster frames, and folder covers.

Streamable video preview / document PDF preview

Files.fm can generate an MP4 streaming preview (HD or custom quality; watermarked when a price is set) and PDF previews for document/archive formats (DOC, XLS, EDOC, ZIP, etc.). Requires the file hash and enabled access. Contact Files.fm for full documentation. See also the "previews and conversion" integration section.

Download folder as ZIP

GET https://api.files.fm/server_scripts/zip/zip_streamer/upload_zip_streamer.php?uhash={folder_hash}

Streams all files in a folder as a ZIP. For password-protected folders add &password=my_password. Limits may apply.

embed_urls.php (path-access URL)

GET https://api.files.fm/api/embed_urls.php?i={file_hash}

Returns the human-readable path-access URL for a file:

{"path_access_url": "https://files.fm/pa/username/folder1/subfolder/filename.jpg"}
https://files.fm/u/{folder_hash}
https://files.fm/f/{file_hash}

Localized domains are supported, for example https://es.files.fm/u/{folder_hash} and https://de.files.fm/u/{folder_hash}.

Sharing management

Files.fm sharing grants named recipients (registered users, email addresses, or — for enterprise organizations — organization user groups) fine-grained access to a file or folder. Access rights are stored per recipient in upload_sharing: CanView, CanRead (download), CanWrite (edit), CanAdd, CanDelete, and CanShare. Two endpoints cover the lifecycle: ajax/share.php creates shares (and sends notification emails), and api/sharing.php lists and adjusts existing shares.

Both are session-authenticated (pass PHPSESSID); they are the same pipeline used by POST /api/signing/share.

ajax/share.php (grant access)

POST https://files.fm/ajax/share.php

Grants access to one or more recipients on a single file or folder, optionally sends share-notification emails, and (for end-to-end encrypted items) stores wrapped keys for the selected recipients' devices. Served from the files.fm web host and authenticated by session.

Target the item with one of:

Parameters (POST):

Name Type Required Description
items[] array Yes Recipients. Each entry is an object { value, item_type }. item_type is email (then value is an email address) or org_user (then value is a Files.fm user id in your organization).
file_view_hash / file_hash string Conditional File hash to share (use this or upload_hash).
upload_hash string Conditional Folder hash to share.
rights[view] bool No Allow preview/view (maps to CanView).
rights[download] bool No Allow download (CanRead).
rights[write] bool No Allow edit/upload (CanWrite).
rights[add] bool No Allow adding files (CanAdd).
rights[delete] bool No Allow delete (CanDelete).
rights[share] bool No Allow re-sharing (CanShare).
description string No Message included in the share email.
submit string Yes Must be 1 to perform the share; other values validate recipients only.
send_share_email string No 0 to suppress the notification email (default sends).
send_notification_once_open string No 0 to disable the "link opened" notification (default on).
save_share_message string No 1 to save the message as the user's default.
date_active_from / date_active_to string No Time-limited access window; from must be <= to.
next_share_emails[] array No Additional emails to chain-share to the same item.
external_user_group int No Enterprise only: external user group that newly added external users are placed in.
signerDeviceID string Conditional The sharing user's device fingerprint. Required with keysByDevice.
keysByDevice object Conditional Map of recipient device fingerprint to { encryptionKey, keySignature }. Required with signerDeviceID; every device must belong to a registered recipient in items[].

Granting the delete right (and folder add/write rights) causes the generated share URL to embed the corresponding delete/add keys.

Response:

{
  "status": "ok",
  "items": {
    "user@example.com": {
      "item_type": "email",
      "value": "user@example.com",
      "email": "user@example.com",
      "is_valid_email": true,
      "user_id": 12345,
      "org_id": 0,
      "can_email": true,
      "have_to_send_enterprise_invite_email": false,
      "enterprise_invite_email_link": ""
    }
  },
  "message": null,
  "invalid_emails": "",
  "unsubscribed_emails": "",
  "sent_emails": "user@example.com"
}

status is ok on success or error on failure. message may be null, no-access-rights, already_shared, marked_as_spam, free_emails_exhausted, or wrong_dates. items is keyed by each recipient's value.

Security note: the share URLs returned and emailed can embed file/folder delete and add keys depending on the granted rights — treat the response and the emails as sensitive.

sharing.php (sharing modal and management)

GET https://api.files.fm/api/sharing.php?Action={action}&...

Session-authenticated endpoint that backs the sharing dialog: it lists existing shares for an item and toggles individual access rights. The session user must hold the allow_sharing right on the target item.

Select the item with one of UploadID, FileID, UploadHash, FileHash, or DvsDocumentId.

Actions (Action parameter):

Action Returns Description
GetModalWindow { Success, HTML } Rendered HTML of the share modal for the item.
GetSharingTable { Success, HTML, ItemNameHTML, ProjectTeamInfo } Rendered HTML table of all current shares (users, emails, organization user groups, external groups) with each assignee's rights and active dates. Enterprise accounts also receive project team info.
UpdateUploadSharing { Success, AccessRights } Toggle a single access right for one assignee.

UpdateUploadSharing parameters:

Name Type Required Description
AssigneeType string Yes One of USER (organization user), ANY_USER, EMAIL, ORG_USER_GROUP, ORG_EXTERN_USER_GROUP.
AssigneeUserID int Yes Id of the assignee (user id, email id, or group id).
AccessRightName string Yes One of CanRead, CanWrite, CanDelete, CanView, CanShare, CanAdd.
AccessRightStatus int Yes 1 to grant, 0 to revoke.
{"Success": true, "AccessRights": {"CanView": 1, "CanRead": 1, "CanWrite": 0, "CanDelete": 0, "CanShare": 0, "CanAdd": 0}}

Setting all rights to 0 effectively removes an assignee's access — there is no separate delete-share endpoint. GetModalWindow and GetSharingTable return pre-rendered HTML for the web UI rather than structured data, so for programmatic listing build on UpdateUploadSharing plus your own bookkeeping.

Organization role/module permissions (the org RBAC table updated by api/permissions.php) are a separate concern from per-file sharing and belong to the Organization Management API (out of scope here).

save_sharing_confirmation.php

GET https://api.files.fm/api/save_sharing_confirmation.php?item_type=FILE&item_id={id}&confirm=1

Confirms (or declines) a pending share for the authenticated user (or via a signed user_id+hash link). item_type is FILE or UPLOAD; set confirm=1 to accept. Optional redirect_after_save=1 redirects to the file browser instead of returning JSON.

{"Success": true, "Error": null, "Message": null}

Utility and account compatibility

log/write.php (app log entries)

Internal endpoint for the Files.fm mobile/desktop app. Not intended for third-party integrations.

POST https://api.files.fm/api/log/write.php?PHPSESSID={session}
Content-Type: application/json

Stores up to 100 app log entries for the authenticated user. Requires a session or user + user_access_token; the user ID and username are taken from the session. Requests with an Origin header are rejected.

{"entries": [{"timestamp": "2026-11-10T12:00:00.000Z", "severity": "ERROR", "log_level": "error", "log_name": "release", "labels": {"buildMode": "RELEASE", "platform": "android", "version": "1.2.3+45"}, "message": "Upload failed"}]}
{"success": true, "accepted": 1}

Errors return {"success": false, "error": {"code": ..., "message": ...}} with HTTP 401 (code 1001, not authorized), 400 (1002, invalid parameters), 413 (1003, body too large or more than 100 entries) or 500 (2000).

Disabled endpoints

Account creation via api/register.php is disabled. New accounts are created through the website or OAuth/SSO first-login auto-provisioning.

Other Files.fm APIs

Calendar and address-book integrations use the CalDAV and CardDAV API at https://calendar.failiem.lv/. It supports discovery, event/contact CRUD, and synchronization using DAV XML and iCalendar/vCard data. These are separate protocol endpoints, not grouped REST operations; the REST OpenAPI specification does not describe them. The calendar workspace's /calendar/api.php is an internal session/CSRF-based JSON interface, not a documented public REST API.

Organization and dealer management has its own separate API, documented in Files.fm_OrgManagement_API.pdf (served from the api/ directory) and implemented by api/manage_organizations.php. It is out of scope for this document. See the public DMS/DVS reference, MCP connector, and WebDAV/FTP protocols. Internal web AJAX endpoints are not a substitute for the documented public API; additional integration requirements should be discussed with support@files.fm.

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.

E-Signature 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.
    

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):
<script type="text/javascript" src="https://api.files.fm/esignature/form.js"></script>
  1. Create a JavaScript object of the class FailiemlvEsignatureForm, passing the form settings. All settings are optional.
objMyFailiemlvEsignatureForm = new FailiemlvEsignatureForm({
    callbacks: {
        on_signing_finished: function (result) { /* ... */ },
        on_form_closed: function (data) { /* ... */ }
    },
    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 Type Required Description
callbacks object No Your JavaScript functions called after specific events in the form.
callbacks.on_signing_finished function No Called when the user finishes signing (see "Receiving the signing result").
callbacks.on_form_closed function No Called when the user closes the form (see "Receiving the form close event").
emobile_signing object No Settings for the eParaksts mobile signing process.
emobile_signing.open_new_tab boolean No Whether eParaksts mobile signing opens eparaksts.lv in a new browser tab instead of redirecting the current page.
allowed_signing_formats object No Allowed file signing formats.
allowed_signing_formats.edoc boolean No Allow signing files in edoc format.
allowed_signing_formats.pdf boolean No Allow signing files in pdf format.
allowed_signing_formats.asice boolean No Allow signing files in asice format.
default_signing_format string No Default signing format: edoc, pdf, or asice.
signature_validation object No Settings for checking existing signatures in a file.
signature_validation.enabled boolean No Whether to check and show existing signatures when the form opens.
sign_files_separate object No Settings for signing multiple files: all in one file, or each in a separate file.
sign_files_separate.allow_select boolean No Whether the user may choose the multi-file signing type.
sign_files_separate.default boolean No Default multi-file method. false = all in one file; true = each in a separate file.

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

To sign multiple files, pass the folder of the uploaded files:

objMyFailiemlvEsignatureForm.showForm( folder_hash, folder_edit_key );

To sign a single file, pass the file instead:

objMyFailiemlvEsignatureForm.showForm( null, null, file_hash, file_delete_key );

Function parameters

Name Type Required Description
folder_hash string Conditional Folder identifier. Required when signing multiple files.
folder_edit_key string Conditional Folder edit key. Required when signing multiple files.
file_hash string Conditional File identifier. Required when signing a single file.
file_delete_key string Conditional File edit/delete key. Required when signing a single file.

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 Type Description
success boolean Whether signing was successful.
folder_hash string Folder identifier of the signed files. Only when signing multiple files.
file_hash string File identifier of the signed file. Only when signing a single file.
signed_file_format string Format/extension of the signed file. Only on success.
signed_file_hash string Identifier of the signed file. Returned on success when signing a single file, or multiple files as "all in one file".
signed_file_delete_key string Signed file edit/delete key. Same conditions as signed_file_hash.
signed_file_hashes array Array of signed file data. Returned on success when signing multiple files "each file individually".
signed_file_hashes[].original_file_name string Name of the original file.
signed_file_hashes[].signed_file_hash string Identifier of the signed file.
signed_file_hashes[].signed_file_delete_key string Signed file edit/delete key.

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.

Receiving the 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:

File or folder data opened in the form

Name Type Description
folder_hash string Identifier of the folder of files to be signed.
file_hash string Identifier of the file to be signed.

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

Files.fm AI API (Ollama-compatible)

Files.fm provides a hosted Ollama-compatible Large Language Model API at https://ai.files.fm. It is a drop-in replacement for Ollama's HTTP interface, so existing tools, SDKs, and automation platforms (such as n8n) can use Files.fm-hosted models without running local GPU infrastructure, in a GDPR-compliant way. It follows the standard Ollama /api/generate and /api/chat schema and semantics. For automations, prefer the https://ai.files.fm/api/generate endpoint. Generate your API keys at https://files.fm/account#api_keys.

Supported models

Model Purpose
gpt-oss:20b General-purpose text generation and reasoning (text only, tools, thinking).
granite4.2:8b Compact text model with tools and thinking.
gemma4:12b Multimodal model: image, audio and text input, tools, thinking.
phi4:14b Plain text completion, no tools or thinking.
qwen3.8:27b Vision-language model (image + text understanding), tools, thinking.
muse-glimmer:30b Multimodal model: image + text understanding, tools, thinking.

If you need other models, ask us.

Authentication

Authentication uses a Bearer token in the HTTP Authorization header:

Authorization: Bearer UserID:RandomString

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 format (see https://docs.ollama.com/api/introduction).

Field Description
model Model name (see supported models above).
prompt Prompt text (used by /api/generate).
messages Chat messages array of {role, content} (used by /api/chat).
think Reasoning level (low recommended for automation).
stream Streaming mode (set false for most integrations).

Example — /api/generate with 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
  }'

Example — /api/chat:

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 — gemma4:12b:

curl --location 'https://ai.files.fm/api/chat' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer UserID:RandomString' \
  --data '{
    "model": "gemma4:12b",
    "messages": [
      { "role": "user", "content": "What is Files.fm? Answer in one sentence." }
    ],
    "stream": false
  }'

/api/generate response format

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

{ "response": "Generated text output from the model.", "done": true }
Field Type Description
response string or object Generated output from the model.
done boolean Indicates that generation has completed.

/api/chat response format

The response matches Ollama's standard structure:

{
  "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

Use Files.fm AI inside n8n for automation tasks such as text summarization, classification, OCR post-processing, internal AI assistants, and document/form analysis. The HTTP Request node provides maximum compatibility and control.

n8n HTTP Request configuration:

Setting Value
Method POST
URL https://ai.files.fm/api/generate
Header Content-Type application/json
Header 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" }

Extract the generated output with the expression {{$json.response}}. It can be forwarded to email nodes, Slack/Microsoft Teams, databases or CRMs, Files.fm document workflows, or webhooks/APIs.

Operational notes:

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:

Use Cases

The upload form is well suited for scenarios such as:

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

Additional Resources and Examples

If you need further clarification, contact support@files.fm. The grouped API format is preferred; feel free to request additional information or features.

Embed a folder as a slideshow iframe:

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

Or embed via the gallery script tag:

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

File conversion and previews

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

Image previews and thumbnails

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

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

Document previews

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

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

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

Video previews and streaming

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

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

Applying a watermark

Files.fm supports text-based watermarks on JPEG and PNG images. Apply one by including the watermark_text parameter in the save_file.php request, for example &watermark_text=YourTextHere.

When a price is set or removed for an image or video file, Files.fm automatically regenerates the file previews (thumbnails) and applies a watermark using the file owner's username. This ensures consistent branding and content protection for monetized or restricted-access media.

AI analysis (server-side)

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

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

Processing model:

Availability - AI features are optional and may require specific account plans or add-ons, feature enablement by Files.fm, and additional configuration depending on use case (e.g. face recognition, moderation, OCR pipelines). For availability, configuration, or API-level access, contact support@files.fm.