Skip to main content
A share is a link to one object that can expire, be revoked, cap the number of downloads and, on Pro and Enterprise, ask for a password. See Links and sharing for how the links behave. Examples use the blob client from Creating the client.

Share or downloadUrl()?

Use downloadUrl() for short-lived links you hand out yourself, and a share when you need to take the link back or control who downloads it.

Creating a share

The result has id, url, expires_at, max_downloads, password (whether one is set), object and object_is_public.
If object_is_public is true, the share link redirects to the object’s permanent public URL: the password, download limit and expiration protect nothing, because the file stays reachable at that URL. Make the object private first, then share it:

Listing shares

Returns an array of shares, each with id, url, object, expires_at, remaining_downloads, password and created_at.

Revoking a share

The link stops working. revoke() resolves to nothing, and revoking a share that does not exist fails with SHARE_NOT_FOUND.
Deleting, moving or renaming the object, or changing its visibility, also breaks its share links: they point to the old id. Create new shares for the new id.
shares.create() and shares.revoke() get a single attempt. Only shares.list(), a read, is retried.
API reference: Create Share, List Shares, Delete Share.

Next steps

Rules and stats

Per-prefix rules and usage stats.

Links and sharing

How public URLs, download links and shares behave.