Docly Developers
Function API only Updated 17 Oct 2026

addFileShare(file, user, access, [message])

Creates a new share / overwrites existing for a specific file and user, and sends an invitation email to the specified user.

Parameters

filestringrequired

Path to the file to share, from the site root.

userstring (email)required

Email of the user. Several emails can be given.

accessstringrequired

A string with letters describing the access level:
R - read (read in Docly and on websites)
M - modify (W also allowed) - requires R
V - Visit (web site read access only "Visit")

Example: "RM" meaning read and modify

messagestringoptional

Optional message to send to user

Returns

true for success, otherwise throws an error — for example when the file is not found (error 1), or only exists in the app the site is published from (error 110). The call runs as the site's publisher.

Example

Normal JavaScript, running in the browser or on the Docly™ server.
docly.addFileShare("test file", "test@docly.net", "V", "Access granted to view file");