API: Sharing files and folders
| Target URL | /api.php/Drive/files/share |
| Required scope | share |
| HTTP Method | POST |
| Output format | JSON |
Request Parameters Reference
| Parameter | Type | Required | Description |
|---|---|---|---|
| path | string | Yes | The FileRun path of the file or the folder. See this page |
| role | string | Yes | One the following roles: uploaderviewercommenterdistributoreditorcontributormanager |
| puid | string | Yes, if no gid or email |
Public ID of FileRun user to share folder with. |
| gid | integer | Yes, if no puid or email |
ID of FileRun group to share folder with. |
| string | Yes, if no puid or gid |
E-mail address of guest user to add and share with. | |
| notify | boolean | No | Set to 1 to send e-mail notifications. |
| message | string | No | Message to include in the e-mail notifications. |
| require_email_otp | boolean | No | Since 2026.4.0. Used only with email. Set to 1 to have every sign-in of the new guest account end with a code sent to its e-mail address, the sign-in link of the share e-mail included. |
Note: If the file or folder was already shared, the share settings will be updated. No errors will be returned in that case.
Note: What a guest account (email) may do with a share is limited by the Guest role, whatever the share role says. A guest can never rename, move or delete, change tags, ratings and other metadata, write comments, share or create web links. A guest can edit files only when the Guest role allows editing (possible since FileRun 2026.4.0). So the roles distributor, contributor and manager give a guest nothing more than viewer, editor or uploader. See Guest accounts.
When the share with an e-mail address (email) is refused, the guest account that the request created is deleted again, so a later request can invite the same address.
A user (puid) can open the share only when the Can interact with permission of each of the two accounts includes the other. When it does not, the share is made, and the message of the answer ends with This user cannot open the share, because their account is not allowed to interact with yours. or This user cannot open the share, because your account is not allowed to interact with theirs. See Sharing files and folders.