Overview
Link revocation allows you to immediately disable access to a link, regardless of its expiration settings. This is useful when:- Content needs to be removed urgently
- A link was shared with unintended recipients
- Security concerns require immediate access termination
- A password has been compromised
- You need to rotate or update content
Revoking a Link
To revoke a link, send a DELETE request to/l/{shortCode}:
Success Response
When revocation succeeds, you receive a 204 No Content response with an empty body:A 204 status code indicates the link was successfully revoked. No response body is returned.
Revocation Implementation
The revocation endpoint is defined in RevokeLinkController:Accessing a Revoked Link
Once revoked, any attempt to access the link will fail:Revocation Validation
From ResolveLinkServiceImpl:71-73, revocation is checked first:Error Handling
Link Not Found
If the short code doesn’t exist:Already Revoked
Revoking an already-revoked link typically returns 204 No Content (idempotent operation). The link remains in the revoked state.Complete Workflow Example
Verify link is accessible
Use Cases
Emergency Content Removal
Compromised Password
Content Rotation
Accidental Share
Audit Trail
All access attempts to revoked links are logged in the audit system withAccessResult.REVOKED. This helps track:
- When the link was revoked
- Who attempted to access it after revocation
- How many attempts were made
Best Practices
Store shortCodes securely
Store shortCodes securely
To enable revocation, you must store the
shortCode value when creating links. Store it in your database with appropriate access controls.Implement revocation APIs
Implement revocation APIs
If you’re building a user-facing application, expose revocation functionality through your UI:
- Admin panel: Allow administrators to revoke any link
- User dashboard: Let users revoke their own links
- Automatic revocation: Implement triggers for suspicious activity
Document revocation policies
Document revocation policies
Clearly communicate to users:
- Who can revoke links
- Whether revocation is reversible (it’s not)
- What happens to users who try to access revoked links
- How to create replacement links
Monitor revocation patterns
Monitor revocation patterns
Track revocation metrics:
- How many links are revoked manually vs. auto-expired
- Average time between creation and revocation
- Common reasons for revocation
- Frequent password compromises
- Incorrect expiration settings
- User confusion about link management
Notify affected users
Notify affected users
If possible, notify users when a link they have access to is revoked:
Use revocation over deletion
Use revocation over deletion
The API marks links as revoked rather than deleting them. This preserves:
- Audit trails for compliance
- Statistics and analytics
- Historical access attempts
Revocation vs. Expiration
| Feature | Revocation | Expiration |
|---|---|---|
| Trigger | Manual API call | Automatic (time or views) |
| Timing | Immediate | Scheduled or on view limit |
| Reversible | No | No |
| Use case | Emergency removal | Planned lifecycle |
| Audit result | REVOKED | EXPIRED or VIEW_LIMIT_REACHED |
Both revocation and expiration result in the same user experience (410 Gone), but they serve different purposes and are tracked separately in audit logs.
Security Considerations
Access Control
The current API doesn’t require authentication for revocation. In production, you should:- Add authentication: Require API keys or OAuth tokens
- Implement authorization: Verify the requester owns the link
- Rate limiting: Prevent abuse of the revocation endpoint
- Audit logging: Log who revoked which links and when
Example: Protected Revocation Endpoint
Prevention of Enumeration Attacks
To prevent attackers from discovering valid short codes:- Return consistent responses for revoked/expired/not-found links
- Implement rate limiting on the revocation endpoint
- Monitor for suspicious patterns (many failed revocation attempts)
- Use longer, more complex short codes
Next Steps
Link Expiration
Learn about automatic expiration options
Creating Links
Understand all link creation options
Security Metrics
Monitor revocation and access patterns
Access Summary
View statistics on revoked links
