Blob Storage: persistent vs temporary storage
Square Cloud's Blob Storage was designed to offer flexibility in file storage, ranging from temporary logs to critical application assets. The main difference between the storage modes lies in the expire parameter.
1. Temporary Storage (expire)
Temporary storage is ideal for files with a short lifecycle, such as on-demand reports, transitional backups, or cache files that don't need to take up space forever.
How It Works:
When uploading, set the expire parameter. It accepts from 1 hour to 1825 days (5 years), in days (30 or 30d) or hours (6h). Terms under 7 days are available only on the Enterprise plan.
- A file with
expiregets an expiration suffix in its name (~e<timestamp>), not a random hash. - After the period, the file is deleted automatically.
2. Persistent Storage (Permanent)
Persistent mode is the right choice for files that make up your application's structure, such as user profile pictures, logos, CSS, or documents that must be available indefinitely.
How It Works:
Upload without the expire parameter. If the prefix has an expiration rule, that rule applies; without a rule, the file is permanent until you delete it.
3. Security hash and overwriting
- The random suffix in the name (e.g.
image_<id>.png) comes only fromsecurity_hash=true, in any mode. Private files always have it. - Without the hash, uploading a file with the same name and prefix replaces the previous one (
overwrite=trueis the default). Withoverwrite=false, the API answers 409 OBJECT_ALREADY_EXISTS.
4. Quick Comparison
Feature | Temporary Storage | Persistent Storage |
|---|---|---|
Parameter |
| No |
Object Name | Original name + expiration suffix | Original name |
Random hash | Only with | Only with |
Lifecycle | Deleted after the set period | Remains until deleted |
Same name | Replaced (unless | Replaced (unless |
5. Which One to Choose?
- Use Temporary for: Transaction receipts, debug logs, and files exported by users for a single download.
- Use Persistent for: Interface images, user uploads (like avatars), and configuration files. For structured data, use a managed database (PostgreSQL, MySQL, MongoDB or Redis, from the Standard plan).
Pro Tip: When you replace a file, Square Cloud purges the edge cache automatically, but the visitor's browser may keep the old version until its Cache-Control expires.
Updated on: 10/04/2026
Thank you!
