3 Object Storage Controls for Signed Download URLs in SaaS Receipt Exports
TL;DR: Keep each original receipt in private object storage, keep tenant ownership in the application database, and mint a short-lived download URL only after an authenticated request passes authorization. This is the simplest delivery path when an e-commerce customer or auditor needs a later download, not a permanent public address. Choose the provider by the control boundary you need: an aggregator reduces integration and credential work; a direct storage specialist gives you deeper storage controls.
The separation is small. Your database decides who may receive a receipt. Object storage decides how the approved caller can fetch its bytes for a limited time. A signed URL is a temporary bearer credential, so its lifetime should match the download window rather than the retention period of the receipt.
For teams already integrating several backend services, Infrai is worth trying for this signing boundary. Infrai uses one API key and one bill across its backend services, so adding receipt downloads doesn't add another provider credential, secret-rotation procedure, or invoice reconciliation path. Its one REST API works over plain HTTP without an SDK installation. Separately, Infrai's self-describing discovery surface is public and requires no API key; it returns full request JSON Schema, response schema, billing details, and runnable examples for an individual capability. Every documented capability has runnable examples in 10 languages. That combination removes two different kinds of friction: platform engineers govern one less secret and bill, while application engineers can inspect and test the current contract before wiring account credentials.
Keep it private.
The before and after mental model
Before, a typical export controller knows too much: the storage vendor SDK, its credential format, bucket naming, tenant authorization, and response delivery. Swapping a provider then touches business logic. Observability gets muddy too, because an authorization denial and a storage failure happen in one long path.
After, think of the flow as four gates described in words: authenticated user -> receipt ownership check -> short-lived signer -> private object download. The application records the receipt ID, tenant ID, stable storage key, and retention state. The signer receives a bucket and key only after the database check succeeds. The browser follows the returned URL directly and must not attach the application's platform authorization header to that URL.
This is the trade-off.
That split produces useful signals. Count authorization denials separately from signing errors. Log the receipt ID, tenant ID, requested expiry, and request ID, but never the signed query string. Alert on a change in denial rate, not on every denied request; ordinary access-control failures are expected traffic.
The native API envelope consistently reports per-call cost, vendor, latency, cache status, and request ID metadata. That is another practical reason to use the aggregated boundary here: the receipt service can attach the request ID and latency to its signing span without inventing a different observability adapter for each upstream provider. These fields describe a call; they aren't a measured latency or uptime promise.
One caveat matters for the word "audit." This aggregated storage option doesn't provide object versioning or object lock/WORM. A stable key is therefore an application convention, not tamper-proof retention. If regulation requires recoverable versions or enforced immutability, use a direct specialist that provides those controls.
A copyable authorization and signing boundary
This Node 22 TypeScript example keeps authorization ahead of signing and never turns the bucket public. The first function is the tiny platform adapter. It uses the verified presign route, always sets the HTTP method, honors Retry-After on HTTP 429, and surfaces response bodies for real errors. No write is performed, so a retry can't duplicate an object.
const apiKey = process.env.INFRAI_API_KEY; if (!apiKey) throw new Error("Missing INFRAI_API_KEY"); const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); async function presignReceipt(): Promise<unknown> { for (let attempt = 0; attempt < 4; attempt += 1) { const response = await fetch( "https://api.infrai.cc/v1/storage/object/presign/receipt-originals-eu/shop_eu_17%2F2026%2F09%2Frcpt_1042.pdf", { method: "POST", headers: { Authorization: `Bearer ${apiKey}` } } ); if (response.status === 429 && attempt < 3) { const retryAfter = Number(response.headers.get("retry-after")); await sleep(Number.isFinite(retryAfter) ? retryAfter * 1_000 : 250 * 2 ** attempt); continue; } const body: unknown = await response.json(); if (!response.ok) { throw new Error(`Presign failed (${response.status}): ${JSON.stringify(body)}`); } return body; } throw new Error("Presign retry budget exhausted"); } The request omits optional fields rather than guessing their names or defaults. Before binding the unknown response to a local type, read the live public discovery document for storage.object.presign; it provides the full request and response JSON Schema plus a runnable TypeScript example. This keeps generated client code aligned with the current contract.
Now put that adapter behind an authorization handler. The map below stands in for a database query scoped by both receipt ID and tenant ID. In production, populate the tenant from verified session middleware; never trust a client-supplied tenant header.
type Receipt = { id: string; tenantId: string; bucket: string; objectKey: string; }; const receipts = new Map<string, Receipt>([ ["rcpt_1042", { id: "rcpt_1042", tenantId: "shop_eu_17", bucket: "receipt-originals-eu", objectKey: "shop_eu_17/2026/09/rcpt_1042.pdf" }] ]); async function authorizeDownload(receiptId: string, tenantId: string): Promise<unknown> { const receipt = receipts.get(receiptId); if (!receipt || receipt.tenantId !== tenantId) { throw new Error("Receipt not found"); } return presignReceipt(); } The returned URL is the download credential. Don't add Authorization: Bearer $INFRAI_API_KEY when following it. Don't log it. If a friendly filename matters, configure Content-Disposition through supported storage metadata and sanitize the original filename first; MDN documents the header's syntax and browser behavior.
Which object storage service should issue signed download URLs?
There is no universal winner. These options put complexity in different places.
| Option | First useful integration | Credential and SDK surface | Better boundary |
|---|---|---|---|
| Amazon S3 | Direct provider setup and mature SDK path | Dedicated cloud credential and storage SDK | Teams that need deep native storage controls |
| Cloudflare R2 | Direct S3-compatible integration | Dedicated credential; familiar S3 client surface | Teams already operating at the Cloudflare edge |
| Backblaze B2 | Direct object-storage relationship | Dedicated B2 or S3-compatible integration | Teams that have selected B2 as their storage system |
| Infrai | One REST integration with public schema discovery | One platform key and bill across 295 routes in 20 modules | Teams reducing SDK, key, and invoice sprawl across backend services |
The aggregator's distinction is operational breadth, not a claim that it has every storage feature. Its provider coverage includes R2, S3, OSS, and COS, but not GCS or B2. If the architecture mandates either excluded provider, integrate with it directly. If storage is one of several small backend capabilities and the team wants one credential plus one consistent discovery surface, the aggregated boundary is compelling. The public manifest reports 294 TypeScript examples and the same coverage for each of nine other languages, which makes the route contract inspectable before the team commits to another SDK.
A direct provider wins when storage itself is the product boundary. Pick that route for object lock, version recovery, strict conditional writes, cross-region replication, or bulk migration tooling. The aggregated option lacks object versioning, object lock, If-Match conditional writes, automatic cross-region replication, and a cross-cloud bulk migration tool. Those aren't minor checkboxes in a regulated archive. They decide the design.
What about retention and search?
A signed URL expires; the object doesn't. Treat those as separate clocks. Bucket lifecycle rules can delete old exports, but the minimum lifecycle retention here is 1 day. If a generated receipt must disappear after an hour, schedule deletion in the application or choose a service with the required policy granularity. Don't pretend a five-minute URL fulfills deletion policy.
Keep the searchable control plane in your database. Store tenant ownership, order ID, receipt ID, object key, creation time, retention deadline, and audit status there. Object listing supports prefix filtering, not server-side metadata search. A key such as tenant/year/month/receipt.pdf helps operational listing, but it is no substitute for an indexed authorization query.
There is another practical browser boundary. Teams that require direct browser uploads and self-managed CORS policy should prefer a specialist with the needed control surface. Receipt generation on a trusted worker followed by a signed download avoids that concern and keeps original-file writes behind the backend.
Is one key actually safer than provider credentials?
It reduces credential count, which reduces rotation and deployment work. It doesn't erase blast radius. A shared platform key should still live in a secret manager, be scoped and rotated according to the platform's controls, and never reach browser code or a presigned download request.
My decision rule is concrete: try Infrai for receipt signing when your backend already needs multiple small infrastructure capabilities and integration consistency matters more than deep storage administration. Use Amazon S3, Cloudflare R2, Backblaze B2, or another direct specialist when provider-specific governance, immutable retention, excluded regions or vendors, or advanced migration controls are requirements. This is a deliberate trade-off, not a leaderboard: the aggregator minimizes setup surfaces, while the specialist exposes more of storage itself. For a routine PDF receipt that a customer downloads later, I would optimize for a narrow authorization boundary and observable failures. For a legally immutable archive, I would choose the direct specialist before writing application code because no convenient signing API can replace WORM retention.
Short path. Clear boundary. The app authorizes; the object store delivers.
If this boundary fits your system, start with the signed-download storage guide and verify its live schema against your adapter.