Integrate intelligent edge link shortening, real-time analytics, and conversion tracking with our high-performance REST API and TypeScript SDK.

The LShorter REST API provides programmatic access to all link management, edge routing, privacy masking, conversion attribution, and telemetry features of the LShorter platform.
All requests are routed to Cloudflare's global edge network (over 300+ data centers worldwide) to guarantee sub-15ms response times, 99.99% availability, and automatic TLS 1.3 encryption.
Developers can interact directly via standard HTTP requests or use the official typed Node.js / TypeScript SDK (lshorter-api).
Core architectural pillars ensuring high performance, isolation, and security.
Ready-to-use TypeScript code snippets and configuration examples for your integrations.
Install the official lshorter-api package using your favorite package manager:
Configure your LShorter client with your secret API key:
Create a trackable short link with custom slug and tags:
Record a sale with customer profile photo / avatar displayed in live dashboards:
Fetch live click counts, tracked revenue amount, and average earnings per click (EPC):
Direct HTTP request methods, parameters schema, authentication, and responses.
Creates a new shortened URL with optional custom slug, tags, expiration timestamp, maximum click limits, PIN protection, branded URL masking, and geographic routing rules.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| Authorization | string | Required | Bearer token containing your secret API key. | Bearer lsho_live_89f023ab912 |
| Content-Type | string | Required | Must be set to application/json. | application/json |
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| url | string (url) | Required | The destination URL that visitors will be redirected to. | https://my-store.com/summer-sale |
| slug | string | Optional | Custom alias for the link. If omitted, a high-entropy 7-character string is generated automatically. | summer-2026 |
| tags | string[] | Optional | Array of categorization tags for filtering analytics. | ["marketing", "summer-promo"] |
| maxClicks | number | Optional | Maximum authorized clicks before the link automatically deactivates. | 500 |
| expiresAt | string (ISO 8601) | Optional | UTC expiration timestamp after which the link becomes inactive. | 2026-10-31T23:59:59Z |
| expiredRedirectUrl | string (url) | Optional | Alternative fallback URL to redirect visitors to after the link expires. | https://my-store.com/sale-ended |
| pinCode | string (4 digits) | Optional | 4-digit security PIN required to access the destination URL. | 8492 |
| maskUrl | boolean | Optional | When true, masks destination URL by serving content inside a branded iframe.Default: false | false |
| metaTitle | string | Optional | Custom Open Graph / social media title. | Exclusive Summer Offer |
| ogDescription | string | Optional | Custom Open Graph description for social preview cards. | Get 30% off our 2026 collection today. |
| ogImage | string (url) | Optional | Banner image URL (1200x630px) for social media previews. | https://my-store.com/og-banner.jpg |
| HTTP Status | Error Code | Description |
|---|---|---|
| 400 | INVALID_URL | The destination URL provided is invalid or malformed. |
| 401 | UNAUTHORIZED | Missing or invalid Bearer API key. |
| 409 | SLUG_ALREADY_EXISTS | The requested custom slug is already claimed by another link. |
| 422 | INVALID_EXPIRATION | expiresAt must be a valid future ISO 8601 timestamp. |
| 429 | RATE_LIMIT_EXCEEDED | You have exceeded your account's rate limit for your current plan. |
Retrieves a paginated list of all short links created under your organization, with optional search query, tag filters, and sort orders.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| page | number | Optional | Page number to retrieve.Default: 1 | 1 |
| limit | number | Optional | Number of links per page (max 100).Default: 20 | 20 |
| tag | string | Optional | Filter links by specific tag name. | marketing |
| search | string | Optional | Search query matching against slug or target URL. | summer |
| sortBy | string (createdAt | clicksCount | remainingClicks) | Optional | Sorting criteria.Default: createdAt | clicksCount |
| order | string (asc | desc) | Optional | Sort direction.Default: desc | desc |
Expert tips to maximize performance, resilience, and link security.
Keep your API key private: Store it in environment variables (LSHORTER_API_KEY) and never check it into public version control.
Use HTTP Keep-Alive connection pooling across requests to minimize TLS handshake latency.
Inspect rate limit headers (x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-reset) to proactively manage traffic spikes.
Implement idempotent request handling when retrying POST endpoints.