Data Retention
Learn how Shablonix manages generated file storage and automatic cleanup.
Overview
All generated documents (PDF, PNG, HTML, DOCX) are stored temporarily and automatically deleted after 24 hours. This retention policy ensures efficient storage usage while giving you ample time to download or transfer your files.
- Generated files are available for 24 hours after creation
- Every API response includes an
expires_attimestamp - Webhook payloads also include the expiration time
- Expired files return a 404 error when accessed
Expiration Details
Every generation response includes an expires_at field indicating when the file
will be permanently deleted.
API Response
The expires_at field appears in all
generation responses:
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "completed",
"format": "pdf",
"created_at": "2024-01-15T10:30:00.000Z",
"completed_at": "2024-01-15T10:30:01.234Z",
"expires_at": "2024-01-16T10:30:00.000Z",
"file_url": "/v1/generate/a1b2c3d4.../download",
"file_size": 142857,
"render_time_ms": 1234
}
Webhook Payload
Webhook notifications for completed documents also include the expiration time:
{
"id": "evt_abc123xyz",
"type": "document.completed",
"created_at": "2024-01-15T10:30:01Z",
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "completed",
"file_url": "/v1/generate/a1b2c3d4.../download",
"file_size": 142857,
"render_time_ms": 1234,
"expires_at": "2024-01-16T10:30:00.000Z"
},
"api_version": "2024-01-01"
}
Download Header
The download endpoint includes the expiration time in a response header:
| Header | Description |
|---|---|
X-Shablonix-Expires-At | ISO 8601 timestamp when the file will expire |
Downloading Files
Download generated files using the file_url from the generation response
before they expire.
# Download a generated document
curl -H "Authorization: Bearer YOUR_API_KEY" \
https://api.shablonix.com/v1/generate/{generation_id}/download \
-o document.pdf
Expired File Behavior
When you attempt to access an expired file, the API returns a 404 error:
{
"statusCode": 404,
"message": "Generated file has expired and is no longer available"
}
This applies to both the download endpoint and the generation status endpoint. To get the document again, you must create a new generation request.
Best Practices
1. Download Immediately
Download generated files as soon as they're ready, especially in production workflows. Don't rely on the 24-hour window.
2. Use Webhooks for Async Downloads
Configure account-level webhooks to be notified when documents are ready. The
webhook payload includes the file_url and expires_at so your system can
download files automatically.
3. Store to Your Own Storage
For long-term storage, download generated documents and upload them to your own storage solution (S3, GCS, Azure Blob, etc.) as part of your webhook handler.
4. Check Expiration Before Serving
If you store Shablonix download URLs, always check the expires_at timestamp before serving
them to your users to avoid broken links.