SourCherry Help Centre
Home â€ș Conversations â€ș Conversations

Signed URL File Upload API

Signed URL File Upload lets you stream files directly from the client to Google Cloud Storage (GCS) using secure, time-limited URLs. This improves upload speed and reliability, eliminates server memory pressure, and enables support for larger media—up to 100MB on WhatsApp and 5MB on other channels. Learn how it works, key safeguards, and how to implement the three-step flow.


TABLE OF CONTENTS


What is Signed URL File Upload?


Signed URL File Upload is an infrastructure upgrade that replaces server-buffered uploads with direct, secure client-to-GCS streaming. Instead of sending file bytes through application servers, clients upload to a short-lived, signed URL issued by SourCherry. This architecture reduces Out-Of-Memory (OOM) risk, speeds up transfers, and enforces file validation and access controls.


Key Benefits of Signed URL File Upload


Understanding the benefits helps you decide when to adopt this flow for messaging and media use cases, especially high-volume or large-file scenarios like WhatsApp.



Three-Step Upload Flow


The signed-URL pattern breaks uploads into discrete phases—request, upload, and completion—so each step can validate metadata, enforce limits, and return actionable errors without risking server memory.



1. Initiate — POST /conversations/messages/upload/initiate
Send file metadata to request a time-limited signed URL and object path.


2. Upload — Client → PUT the file directly to the signed URL (GCS)
Stream the file bytes to GCS using the provided URL before it expires.


3. Complete — POST /conversations/messages/upload/complete
SourCherry verifies the stored object and returns the public URL for use in messages.


Channel-Based Size Limits


Different messaging channels have different maximum media sizes. Enforcing limits up front prevents wasted bandwidth and faster error feedback.



Content-Type Validation


Accurate MIME types help keep uploads safe and compatible. Dual-stage validation blocks spoofed or mismatched files that could break downstream delivery.



Security Guards & Access Control


Strong guards protect storage namespaces and ensure only authorized users upload files to the correct conversation and location.



Error Handling & Expiry


Knowing how errors surface at each phase helps you implement resilient clients that recover gracefully from validation failures or expired URLs.



Implementation Tips


These practical pointers reduce friction during integration and improve success rates for large uploads.



Frequently Asked Questions


Q. Is the “Complete” call required?
Yes. Completion verifies the object in storage and returns the final URL for messaging.



Q. What happens if the signed URL expires mid-upload?
Restart the flow: re-run Initiate to get a fresh signed URL, then upload and complete.



Q. Are objects public after completion?
The Complete step returns a public URL for use in messages. Follow your organization’s data handling policies when sharing.



Q. Can I upload any file type if the size fits?
No. Content-type validation blocks mismatches; ensure the file extension and Content-Type are correct.



Q. Do other channels besides WhatsApp support 100MB?
No. Other channels are limited to 5MB.



Q. How does this improve stability?
Files stream directly to GCS; the application server never buffers file content, eliminating OOM risk.



Q. What’s the signed URL lifetime?
Signed URLs expire after 15 minutes.



Q. Can I reuse the same signed URL for multiple files?
No. Each Initiate call issues a URL for a specific file/path and timeframe.