Four ways to share a file
Private to one person, shared with everyone in a customer workspace, a public preview, or a paid download that only a buyer can fetch.
Your backend asks TenancyEngine for a short-lived upload URL and sends the file straight to it. You never hold a cloud storage key.
Needs an API key with the storage scopes you use (storage.read, storage.write, storage.grants.write). Storage limits are set on your plans.
Private to one person, shared with everyone in a customer workspace, a public preview, or a paid download that only a buyer can fetch.
Upload the file privately, grant read access to the purchase, and ask for a download URL only after your app has rechecked the payment. A grant can expire and can be revoked.
Files uploaded from a customer’s portal belong to that customer’s workspace. Files your backend uploads belong to your app and stay private until you decide otherwise.
Set a maximum file size and a retention period for each bucket, and watch the file count and bytes stored in the console.
These calls come from the TenancyEngine.Sdk package on NuGet. Every capability is also a REST API, so any language that can make an HTTPS request can use it.
using System.Net.Http.Headers;
// 1. Ask for an upload URL for a private file you will sell.
var upload = await te.RequestStorageUploadUrlAsync("my-app",
TenancyEngineStoragePatterns.PurchasedDownloadUpload("bundle.zip", "application/zip"), ct);
// 2. Send the bytes to that URL, then confirm the upload.
using var put = new HttpRequestMessage(HttpMethod.Put, upload.UploadUrl)
{
Content = new ByteArrayContent(bytes),
};
put.Content.Headers.ContentType = new MediaTypeHeaderValue("application/zip");
(await http.SendAsync(put, ct)).EnsureSuccessStatusCode();
await te.ConfirmStorageUploadAsync("my-app", upload.ObjectId, ct);
// 3. After a purchase, grant that purchase read access for two hours.
await te.CreateStorageGrantAsync("my-app",
TenancyEngineStoragePatterns.PurchasedDownloadGrant(
upload.ObjectId, purchaseId, DateTimeOffset.UtcNow.AddHours(2)), ct);
// 4. When the buyer asks, and your app has rechecked the payment:
var downloadUrl = await te.GetStorageDownloadUrlAsync("my-app", upload.ObjectId,
TenancyEngineStoragePatterns.PurchasedDownloadUrl(purchaseId), ct);No. Uploads and downloads go through short-lived URLs that TenancyEngine issues for your app.
Keep the file private, create a grant tied to the purchase, and request a download URL only after your app has confirmed the payment is still good.
Yes. Set a retention period on a bucket and files are deleted after that many days.
One app and up to five customer workspaces. Upgrade when you need more.
Request access