POST/user/shares

Create a share

Creates a new sharing link for files or folders belonging to the authenticated user. Set paths to the shared files or folders and use scope to choose read, write, or read/write access; you can also configure restrictions, expiration, and recipient authentication. The share ID is generated automatically and returned in the response headers.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

17 body fields

Settings for the new sharing link and its access rules.

allow_fromarray<string>optional
Limit the share availability to these IP/Mask. IP/Mask must be in CIDR notation as defined in RFC 4632 and RFC 4291, for example "192.0.2.0/24" or "2001:db8::/32". An empty list means no restrictions
created_atintegeroptional
creation time as unix timestamp in milliseconds
descriptionstringoptional
optional description
expires_atintegeroptional
optional share expiration, as unix timestamp in milliseconds. 0 means no expiration
groupsarray<object>optional
Groups granted access to the share, with each group's permissions represented as a bitmask: `1` for read, `2` for write, and `4` for delete; combine values to grant multiple permissions.
idstringoptional
auto-generated unique share identifier
last_use_atintegeroptional
last use time as unix timestamp in milliseconds
max_tokensintegeroptional
maximum allowed access tokens. 0 means no limit
namestringoptional
Name of the share.
optionsobjectoptional
Additional access options: set `auth_mode` to `1` to enable email authentication and provide recipient addresses in `emails`; set `legal_agreement` to `1` to require agreement acceptance, if enabled by a system administrator.
passwordstringoptional
optional password to protect the share. The special value "[**redacted**]" means that a password has been set, you can use this value if you want to preserve the current password when you update a share
pathsarray<string>optional
paths to files or directories, for share scope write this array must contain exactly one directory. Paths will not be validated on save so you can also create them after creating the share
scopeintegeroptional
Scopes: * `1` - Read * `2` - Write * `3` - Read/Write
Allowed:123
updated_atintegeroptional
last update time as unix timestamp in milliseconds
used_tokensintegeroptional
Number of access tokens used for the share.
user_permissionsintegeroptional
Computed bitmask representing the share permissions. 1 means Read, 2 Write, 4 Delete
usernamestringoptional
Owner of the share. Only the owner can update paths and manage group membership

6 status codes
201Returns a success response; the newly generated share ID is provided in the response headers.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
400Returned when the share request is invalid.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
401Returned when the request is unauthenticated.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
403Returned when the authenticated user is not permitted to create the share.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
500Returned when an internal server error occurs.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
defaultUnexpected Error
errorstringoptional
error description if any
messagestringoptional
message, can be empty

Error handling

A 400 is returned when the share request is invalid; a 401 when the request is unauthenticated; a 403 when the authenticated user is not permitted to create the share; and a 500 when an internal server error occurs. scope must be 1, 2, or 3; allow_from entries must use CIDR notation, and when options.auth_mode is 1, options.emails must contain the recipient email addresses. For a write-scoped share, paths must contain exactly one directory.