Shared links: create one with settings (audience, access, expiry, password), reuse an existing one, list, and revoke.

Anyone who has a public link can open the file, so treat links as sensitive. Team and shared-folder policies can narrow what you ask for: check link_permissions.effective_audience / resolved_visibility on the result.

Scopes. sharing.write to create and revoke, sharing.read to list.

Values

SETTING_KEYS

SETTING_KEYS: Vec [
  "audience",
  "access",
  "allow_download",
  "expires",
  "link_password",
  "require_password",
  "requested_visibility"
]

Functions

fn (path: Str): Map
fn (path: Str, opts: Map): Map

POST sharing/create_shared_link_with_settings - create a shared link for a file or folder. Returns the link metadata (url, name, link_permissions, expires, ...). Fails with 409 shared_link_already_exists when the path already has a link: use get-or-create-shared-link to reuse it.

link ::dropbox::sharing/create-shared-link("/Reports/Q3.pdf", {audience: "team", expires: "2026-12-31T23:59:59Z"})
link.url
fn (error: Result): Map?

The link metadata Dropbox returns inside a shared_link_already_exists error (pure), or null.

Example

e err({error: {
  ".tag": "shared_link_already_exists",
  shared_link_already_exists: {".tag": "metadata", metadata: {url: "https://www.dropbox.com/s/abc/Q3.pdf"}}
}})
::dropbox::sharing/existing-link(e)  // {url: "https://www.dropbox.com/s/abc/Q3.pdf"}
fn (path: Str): Map
fn (path: Str, opts: Map): Map

Return the path's existing shared link, or create one with opts settings. When a link exists, its current settings are kept (they are not changed to match opts).

Example

link ::dropbox::sharing/get-or-create-shared-link("/Reports/Q3.pdf", {audience: "team"})
link.url
fn (url: Str): Map
fn (url: Str, opts: Map): Map

POST sharing/get_shared_link_metadata - the metadata of a shared link url (path and link_password in opts for a file inside a shared folder link or a protected link).

Example

info ::dropbox::sharing/get-shared-link-metadata("https://www.dropbox.com/s/abc/Q3.pdf")
info.name
fn (opts: Map): Map?

SharedLinkSettings from opts (pure), or null when none are set: audience ("public", "team", "no_one"), access ("viewer", "editor", "max", "default"), allow_download, expires ("2026-12-31T23:59:59Z"), link_password with require_password: true. A settings Map in opts is merged too. Some settings need a paid plan.

Example

// Team-only and view-only, until the end of the year
::dropbox::sharing/link-settings({audience: "team", access: "viewer", expires: "2026-12-31T23:59:59Z"})
fn (opts: Map): Vec
fn (opts: Map, limit: Int?): Vec

Every shared link (all pages), or at most limit. Options as for list-shared-links.

Example

links ::dropbox::sharing/list-all-shared-links({}, 500)
length(links)
fn (): Map
fn (opts: Map): Map

POST sharing/list_shared_links - one page of the user's shared links: {links, has_more, cursor?}. Options: path (links that give access to it, including links to parent folders unless direct_only: true), cursor (from the previous page; only returned when no path is given).

Example

page ::dropbox::sharing/list-shared-links({path: "/Reports/Q3.pdf", direct_only: true})
map(page.links, %.url)
fn (url: Str): Bool
fn (url: Str, opts: Map): Bool

POST sharing/revoke_shared_link - revoke a shared link by url. The file may stay reachable through links to its parent folders (find them with list-shared-links({path})). Returns true.

Example

::dropbox::sharing/revoke-shared-link("https://www.dropbox.com/s/abc/Q3.pdf")