↑↓ to navigate ↵ to open Esc to close Search by Algolia

You are reading the documentation of FileRun 2026.4.0, which is not released yet. It is subject to change, so do not use it for planning. Read this page for FileRun 2026.3.0

API: Create web links on files and folders

Target URL /api.php/Drive/files/weblink
Required scope weblink
HTTP Method POST
Output format JSON

Request Parameters Reference

Parameter Type Required Description
path string Yes The FileRun path of the target file, folder or collection. See this page
role string No One of the following: viewer (the default), commenter, editor, uploader. uploader can be used only with folders. editor requires that the account may edit the item, commenter that it may read metadata or comments.
password string No The password must satisfy the password policy of the installation.
expiry string No MySQL datetime format Y-m-d H:i:s, or a date as Y-m-d.
download_limit integer No The maximum number of downloads. Only for links which point to a file. Send an empty value to remove a limit.
download_terms string No Terms the visitor has to accept before downloading.
require_login boolean (1/0) No Only logged in FileRun users will be able to access the link.

A parameter which is not in this list is refused ("Bad request, unknown option ..."). When the item already has a web link, its settings are updated with the values sent.

Example reply:

 1{
 2    "success": true,
 3    "msg": ["..."],
 4    "status": "created", //can also return "updated",
 5    "url": "https:\/\/www.yoursite.com\/wl\/?id=CtmsT8IWoen3JDZIVbxvR3SH45gvvvxs",
 6    "password": null
 7}

password holds the password of the link, or null when the link has none. When the administrator requires a password on every link, FileRun generates one for a link that is created without a password, and the reply is the only place where the client gets it. See Advanced configuration.

Sharing several items as a collection

Available since FileRun 2026.4.0.

Target URL /api.php/Drive/files/share_as_collection
Required scope weblink
HTTP Method POST
Output format JSON

One request creates a collection, adds the files and folders to the collection, and creates a web link on the collection. See Collections.

Request Parameters Reference

Parameter Type Required Description
name string Yes The name of the new collection. Dots and spaces at the end of the name are removed.
paths array Yes The FileRun paths of the files and folders, such as /ROOT/HOME/report.pdf. Sent as paths[]=/ROOT/HOME/report.pdf&paths[]=/ROOT/HOME/Photos. See this page

One path is enough. The file manager offers the option only for two or more items, but the API does not have this rule.

The link has the role viewer. The default settings of new links, which the administrator can set in the configuration file, also apply to it. To change the options of the link, send the path of the collection to /api.php/Drive/files/weblink, as described above.

The collection does not contain copies of the files and folders. It refers to them. Removing the collection also removes its web link.

Example reply:

 1{
 2    "success": true,
 3    "msg": ["The collection \"Shared files\" was created and shared with a link."],
 4    "collection": {
 5        "path": "/ROOT/Collections/12",
 6        "name": "Shared files"
 7    },
 8    "url": "https:\/\/www.yoursite.com\/wl\/?id=CtmsT8IWoen3JDZIVbxvR3SH45gvvvxs",
 9    "password": null
10}

collection holds the FileRun path and the name of the new collection. url holds the address of the web link. password holds the password of the link, as for /api.php/Drive/files/weblink.

Every item is checked before the collection is created. So a refused request creates nothing. These are some of the reasons for a refusal:

  • The account already has a collection with the same name ("A collection named "Shared files" already exists!").
  • One of the paths is a collection ("This type of object cannot be added to a collection!").
  • One of the items cannot be shared with a link. An example is an item that another user shared with the account with the role viewer ("The original share does not allow resharing!").
  • The account does not have the permission to create web links ("You are not allowed to create web links!").
  • The account does not have the permission to use collections ("You are not allowed to manage collections!").

When a later step fails, the collection that was already created is removed.