SiaSia Developer Portal

Share an Object

Generate a time-limited URL that anyone can use to download an object.

⚠️ Warning

Share URLs are public links. A share URL grants access to anyone who has it. It can't be restricted to specific users or revoked once shared. Even after the URL expires, anyone who accessed it could have pinned the object into their own account.

To share a set of objects with access you can revoke, use a sharing key instead (Rust, Python, JavaScript and Dart SDKs).

A malformed share URL is rejected before any network call: the SDK validates that the URL's encryption-key fragment is base64url-encoded and decodes to exactly 32 bytes, so a corrupted or hand-edited link fails immediately with a clear error instead of silently downloading garbage.

Generate a share URL

rust
use chrono::{Duration, Utc}; let obj = sdk.object(&object_id).await?; let expires = Utc::now() + Duration::hours(1); let share_url = sdk.object_share_url(&obj, expires)?; println!("Share URL: {share_url}");

Download from a share URL

rust
use sia_storage::DownloadOptions; let shared_obj = sdk.object_from_share_url(share_url).await?; let mut reader = sdk.download(&shared_obj, DownloadOptions::default())?; let mut bytes = Vec::new(); tokio::io::copy(&mut reader, &mut bytes).await?; println!("Downloaded: {}", String::from_utf8_lossy(&bytes));