Share a file

PUT /api/2.0/files/file/{fileId}/share

Request

Sets the sharing settings to a file with the ID specified in the request.

Note: Each of the sharing parameters must contain two values: "ShareTo" - ID of the user with whom we want to share a file, "Access" - access type which we want to give to the user (Read, ReadWrite, etc).

Authorization

An API key is a token that you provide when making API calls. Include the token in a header parameter called Authorization.

Example: Authorization: 864FE52C-1C1C-469F-9308-51DAFEFE7436.

Headers

Acceptenum of string

Can be one of: application/json.

Content-Typeenum of string

Can be one of: application/json.

Path

fileIdstring

File ID

Body

sharearray of object

Collection of sharing parameters

ShareTostringformat: uuid
Accessenum of integerformat: int32

[0 - None, 1 - ReadWrite, 2 - Read, 3 - Restrict, 4 - Varies, 5 - Review, 6 - Comment, 7 - FillForms, 8 - CustomFilter]

Can be one of: None, ReadWrite, Read, Restrict, Varies, Review, Comment, FillForms, CustomFilter.

notifyboolean

Notifies users about the shared file or not

sharingMessagestring

Message to send when notifying about the shared file

advancedSettingsunknown

Advanced settings which prohibit printing, downloading, copying the file, and changing sharing settings

Examples

PUT /api/2.0/files/file/%7BfileId%7D/share HTTP/1.1
Accept: application/json
Content-Length: 138
Content-Type: application/json
Host: example.com

{
  "share": [
    {
      "value": {
        "ShareTo": "2fdfe577-3c26-4736-9df9-b5a683bb8520",
        "Access": "0"
      }
    }
  ]
}
curl --request PUT \
  --url https://example.com/api/2.0/files/file/%7BfileId%7D/share \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "share": [
    {
      "value": {
        "ShareTo": "2fdfe577-3c26-4736-9df9-b5a683bb8520",
        "Access": "0"
      }
    }
  ]
}'

Responses

200

Shared file information

401

Unauthorized

Get Help

  • If you have any questions about ONLYOFFICE Workspace, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).