Overview
All short links in shrtnr have an expiration date. This keeps the database clean, respects user privacy, and prevents dead links from accumulating. You can set expiration times from 1 to 30 days when creating or editing links.Default Expiration
All links have automatic expiration:- Guest users: 7 days (fixed, cannot be changed)
- Authenticated users: 7 days (can be customized from 1-30 days)
The 30-day maximum ensures the database doesn’t accumulate permanent links while giving users flexibility for medium-term campaigns.
How Expiration Works
When a link is created:Set expiration days
Choose how many days (1-30) until the link expires, or accept the default 7 days.
Calculate expiration date
shrtnr calculates the exact expiration timestamp: current time + (days × 24 hours).
Setting Expiration on Creation
For Authenticated Users
On the home page, signed-in users can set custom expiration:- Paste your URL
- Find the “Expires in (days, 1–30)” field
- Enter a number between 1 and 30
- Click Shorten
For Guest Users
Guest users cannot customize expiration:- All guest links expire in exactly 7 days
- No option to extend or shorten the expiration
- Links cannot be managed after creation
To get custom expiration times, see the Authentication guide to create an account or sign in.
Editing Expiration Dates
Authenticated users can change expiration dates after creation:Open your dashboard
Navigate to your dashboard (see Dashboard guide) to see all your links.
Select new expiration date
Click the expiration date picker and choose a new date (up to 30 days from today).
Expiration Date Constraints
When editing expiration:- Minimum date: Today (cannot set past dates)
- Maximum date: 30 days from today
- Null value: You can remove expiration by clearing the date (sets to null)
Validation & Clamping
shrtnr automatically validates and corrects invalid expiration values:| Input | Result | Reason |
|---|---|---|
0 | 7 days | Below minimum, use default |
-5 | 7 days | Below minimum, use default |
15 | 15 days | Valid, use as-is |
45 | 30 days | Above maximum, clamp to max |
7.8 | 7 days | Decimal floored to 7 |
NaN | 7 days | Invalid number, use default |
What Happens When Links Expire
When someone tries to access an expired link:- Redis cache may have already evicted the entry (TTL expired)
- Database query checks if
expires_atis in the past: - 404 response: If expired, return “Not found” without redirecting
- No click tracking: Expired links don’t record analytics
Expired links return a standard 404 error page, not a custom “link expired” message.
Redis Cache TTL
The Redis cache respects link expiration:- TTL calculation: Expiration time minus current time, in seconds
- Minimum TTL: 1 second (prevents immediate expiration)
- Auto-eviction: Redis automatically removes expired entries
Viewing Expiration in Dashboard
Your dashboard shows expiration dates for all links:Desktop Table View
The “Expires” column displays formatted dates:Mar 15, 2026
Mobile Card View
Expiration appears in the link details:Links without expiration show ”—” (desktop) or “No expiry” (mobile), but this may not occur in practice since all links have expiration dates.
Best Practices
Expiration Strategy
Short-term campaigns (1-7 days)
- Social media posts
- Flash sales
- Event registrations
- Newsletter links
- Weekly promotions
- Temporary landing pages
- Monthly campaigns
- Seasonal promotions
- Extended beta programs
Common Questions
Can I extend a link that’s about to expire?
Yes! Edit the link in your dashboard and set a new expiration date (up to 30 days from today).What if I need a link for longer than 30 days?
You can edit the link before it expires to extend it another 30 days. However, this requires manual intervention.Do expired links get deleted?
Expired links remain in the database but won’t redirect. Future cleanup jobs may remove old expired links.Can I remove expiration entirely?
The current implementation expects all links to have expiration dates. Removing expiration may not work as expected.Related Features
- URL Shortening - Create short links with automatic expiration
- Dashboard - View and edit link expiration dates
- Custom Slugs - Create memorable links with custom expiration
- Analytics - Track link performance before expiration