Hi
Product
Features
Security
Difference
Limits
FAQ
Pricing
Doc & Api
Get started free
NEXT-GEN LINK INFRASTRUCTURE

Stop guessing.
Start improving.

Deploy custom domains, ISO country routing, A/B split testing, PathLock™ PIN gates, and deterministic revenue attribution in under two minutes.

Get startedAccess our plans
Platform
  • Country & Device Routing
  • Weighted A/B Testing
  • Revenue Attribution (EPC)
  • Dynamic QR Studio
Security & Access
  • PathLock™ PIN Protection
  • Branded URL Masking
  • Click Limits & Expiration
  • Custom OpenGraph Cards
Developers
  • REST API & SDK Quickstart
  • Real-Time Click Telemetry
  • Signed Webhooks & Events
  • Full Documentation Hub
Legal & Trust
  • Privacy Policy (GDPR)
  • Terms of Service
  • No-Refund Policy
  • Dashboard Overview
LShorter Logo
LShorter© 2026 LShorter Inc.
Built on Cloudflare Edge Network
All 310+ Cloudflare Edge PoPs Operational
Privacy•Terms•Refunds
LShorter Logo
LShorter
HiHiProductProductFeaturesFeaturesSecuritySecurityDifferenceDifferenceLimitsLimitsFAQFAQPricingPricing
Doc & ApiDoc & Api
SDK & API Reference
Endpoints REST, clés Bearer et SDK TypeScript
Routage intelligent & Géo
Ciblage pays, OS mobile et redirection Edge
PathLock™ & Sécurité
Protection par code PIN, expiration et masquage
Télémétrie & Analytics
Flux de clics en direct, attribution et webhooks
RESSOURCESDocumentation

Documentation

Get started
LShorter Logo
LShorter
All guides & documentation

Click Limits & Scheduled Expiration

Automate campaign closures with maximum click quotas (flash sales) and precise UTC expiration schedules.

3 min read•Official Edge Documentation
Click Limits & Scheduled Expiration

Overview & Architecture

Limitation and expiration features automate the conclusion of marketing campaigns, limited promo deals, or restricted beta invites without requiring manual developer intervention.

Every visit triggers an atomic increment of clicksCount directly on Cloudflare Edge nodes. Once a limit is reached (clicksCount >= maxClicks) or the expiration date passes, the link instantly transitions in under 10ms to inactive status or redirects to a fallback URL.

Key Principles

Core architectural pillars ensuring high performance, isolation, and security.

01Lock-Free Atomic Counter (Count)
Edge atomic increment eliminates race conditions during simultaneous viral traffic spikes (50,000+ clicks/second).
02Real-Time remainingClicks Calculation
remainingClicks = Math.max(0, maxClicks - clicksCount). Powers live scarcity and urgency badges.
03ISO 8601 UTC Timestamps
Set an exact universal expiration date and time without timezone conversion issues.
04Customizable Fallback Redirect
Redirect to an 'Offer Ended' waitlist page or display a branded expired screen.
SDK Integration

Implementation & SDK Examples

Ready-to-use TypeScript code snippets and configuration examples for your integrations.

1. Checking Atomic Counters and remainingClicks

Monitor quota consumption in real time for customer user interfaces:

check-remaining-clicks.ts
typescript
12345678
import { lshorter } from "@/lib/lshorter";
const linkStatus = await lshorter.links.get("vip-flash");
console.log("Consumed clicks counter (count):", linkStatus.clicksCount); // e.g. 243
console.log("Max authorized limit (maxClicks):", linkStatus.maxClicks); // 500
console.log("Remaining clicks / spots:", linkStatus.remainingClicks); // 257
console.log("Current link status:", linkStatus.isExpired ? "Expired" : "Active");
REST API Specification

API Endpoints & Reference

Direct HTTP request methods, parameters schema, authentication, and responses.

PATCH

Update Click Limits & Expiration

Bearer <API_KEY>60 to 1,400 req/min (by plan)
https://lsho.cc/api/v1/links/:id/limits

Updates the maximum click quota, expiration timestamp, or expired fallback URL for an active link.

Path Parameters

ParameterTypeRequiredDescriptionExample
idstringRequiredShort link slug or ID.vip-flash

Request Body Parameters

ParameterTypeRequiredDescriptionExample
maxClicksnumber | nullOptionalMaximum authorized clicks, or null to remove the limit.500
expiresAtstring (ISO 8601) | nullOptionalUTC expiration timestamp, or null to remove expiration.2026-11-15T23:59:59Z
expiredRedirectUrlstring (url)OptionalDestination URL after expiration.https://events.com/waitlist

Request Examples

bash
12345678
curl -X PATCH "https://lsho.cc/api/v1/links/vip-flash/limits" \
-H "Authorization: Bearer $LSHORTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"maxClicks": 500,
"expiresAt": "2026-11-15T23:59:59Z",
"expiredRedirectUrl": "https://events.com/waitlist"
}'

Response Payload

200 OKUpdated limits applied across all global Edge points.
response-200.json
json
123456789101112
{
"id": "link_lim_481029",
"slug": "vip-flash",
"shortUrl": "https://lsho.cc/vip-flash",
"clicksCount": 243,
"maxClicks": 500,
"remainingClicks": 257,
"expiresAt": "2026-11-15T23:59:59.000Z",
"expiredRedirectUrl": "https://events.com/waitlist",
"isExpired": false,
"status": "active"
}

Recommended Best Practices

Expert tips to maximize performance, resilience, and link security.

Recommendation 01

Always configure an expiredRedirectUrl so you never lose valuable customer traffic after your campaign ends.

Recommendation 02

Ensure timestamps are passed in standard UTC (ISO 8601 with trailing Z) to avoid local daylight savings or timezone offset bugs.

Recommendation 03

Subscribe to webhooks (link.limit_reached, link.expired) to receive automated notifications in Slack or Discord.

Previous guideReal-Time Telemetry & Metrics APINext guideBranded URL Masking & White-Label Embedding

Related Guides & APIs

Quickstart & REST API Reference
Quickstart & REST API Reference
Integrate intelligent edge link shortening, real-time analytics, and conversion tracking with our high-performance REST API and TypeScript SDK.
Read guide & API
Dynamic Routing & Edge Geolocation
Dynamic Routing & Edge Geolocation
Redirect visitors to contextual URLs based on their origin country or continent with ultra-low latency.
Read guide & API