How to Use the Lnky.pk API: A Complete Developer Guide (2026 Edition)

40 mins read

Introduction: Turn Links Into Infrastructure with the Lnky.pk API

In 2026, links are no longer just a way to move users from page A to page B.
They are:

Traffic routers

Tracking points

Attribution anchors

Retargeting triggers

On-ramps from offline to online

If you’re building an app, running a SaaS, managing campaigns at scale, or automating internal tools, you need links to be programmable.

That’s exactly what the Lnky.pk API gives you.

With a single API, you can:

Shorten URLs

Attach pixels

Add geo/device/language targeting

Generate QR codes

Organize links into campaigns & channels

Manage branded domains

Create and track CTAs & splash pages

Work with users and plans (for admin use cases)

This guide walks you through how to actually use the Lnky.pk API, from authentication and rate limits to real-world use cases and example flows.


1. What the Lnky.pk API Can Do (High-Level Overview)

Lnky.pk is not “just another shortener API.”
It’s a link infrastructure layer for your product or stack.

Through the API, you can manage:

🔐 Account & Users

Get account details

Update account email/password

For admins: list, create, update, and delete users

Generate SSO login URLs for users via the API

🌐 Branded Domains

List branded domains

Add custom domains

Update root/404 redirects

Delete domains

Perfect for apps or agencies that offer white-label link management.

📣 CTA Overlays & Custom Splash Pages

List CTA overlays

List custom splash pages
These can be attached to links to show custom overlays or interstitial pages before redirect.

🎯 Campaigns

List campaigns

Create campaigns (with slug & public/private settings)

Update campaigns

Assign links to campaigns

Delete campaigns

Think of campaigns as buckets of links for specific initiatives: “Black Friday,” “Facebook Ads,” “Influencer A,” etc.

📺 Channels

List channels

List items (links/bio/QR) inside a channel

Create channels

Assign items to a channel

Update or delete channels

Channels are great for organizing by clients, brands, categories, or projects.

🔗 Links (Core URL Shortener)

List links (with pagination & sorting)

Get a single link + analytics

Shorten a link with rich options (password, splash, geo, device, pixels, custom domain, expiry, parameters, deeplinks, etc.)

Update a link with the same rich options

Delete a link

This is the heart of the API.

🎯 Pixels

List pixels

Create pixels (Facebook, TikTok, GA, GTM, Twitter, LinkedIn, Pinterest, Snapchat, Reddit, Quora, etc.)

Update pixels

Delete pixels

These connect your links to your ad platforms and analytics tools.

📱 QR Codes

List QR codes

Get a detailed single QR (with scan analytics)

Create QR codes for text, link, vCard, email, phone, SMS, Wi-Fi

Update QR codes

Delete QR codes

Great for offline → online attribution via posters, menus, packaging, events.

💳 Plans & Subscriptions (Admin)

List plans with limits (links, clicks, splash, overlay, pixels, domain, etc.)

Subscribe a user to a plan (monthly/yearly/lifetime) via API

Ideal for platforms building reseller or multi-tenant SaaS models on top of Lnky.pk.


2. Authentication: How the Lnky.pk API Secures Requests

Before any request is accepted, Lnky.pk expects an API key in the Authorization header.

Every registered user gets an API key

The key must be sent as a Bearer token

If the key is missing or invalid, the API returns an error

🔑 Example: Auth Header

Authorization: Bearer YOUR_API_KEY_HERE Content-Type: application/json

You’ll find your API key in your Lnky.pk dashboard under Developer API.
Keep it secret, never commit it to Git, and never expose it in frontend code.


3. Rate Limits: How Many Requests Can You Make?

Lnky.pk protects the API with a rate limiter so the platform remains stable.

Default: 30 requests per minute (may vary by plan)

Rate limit info is sent via response headers:

X-RateLimit-Limit: 30 X-RateLimit-Remaining: 29 X-RateLimit-Reset: TIMESTAMP

You can use these headers to:

Back off when you’re close to the limit

Implement client-side throttling

Design polite background jobs & cron tasks

As you scale, higher tier plans can raise these limits.


4. Response Format & Error Handling

All Lnky.pk API responses are JSON.

Core rule:

error: 0 → success

error: 1 → something went wrong

🧩 Error Example

{  "error": 1,  "message": "An error occurred" } 

Typical best practices:

Always check error before trusting the data

Log message for debugging

Also inspect HTTP status codes (e.g., 200, 400, 401, 404, 429)

In PHP, you might decode JSON like:

$response = json_decode($rawResponse, true); if ($response['error'] === 0) {    // handle data } else {    // handle error, log $response['message'] }


5. First Steps: Get Your Account Data via API

A simple way to verify everything works is to hit the Account endpoint.

📥 Endpoint

GET https://lnky.pk/api/account

🧪 Sample cURL Request

curl --location --request GET 'https://lnky.pk/api/account' \  --header 'Authorization: Bearer YOUR_API_KEY_HERE' \  --header 'Content-Type: application/json' 

✅ Typical Response

You’ll receive basic profile data like:

id

email

username

avatar

status (free / pro / business)

expires

registered

This is perfect for:

Building custom dashboards

Showing profile info inside your own app

Verifying the key is working correctly


6. Working with Branded Domains via API

If you offer white-label features or want multiple brands under your system, the domain endpoints are powerful.

🔍 List Branded Domains

GET https://lnky.pk/api/domains?limit=2&page=1

You can paginate with limit and page.

This returns an object with:

domains[] each containing: id, domain, redirectroot, redirect404

➕ Create a Branded Domain

POST https://lnky.pk/api/domain/add

Body parameters:

domain (required) – including http or https

redirectroot (optional) – where root domain goes

redirect404 (optional) – custom 404 redirect

Example body:

{  "domain": "https://brandlinks.com",  "redirectroot": "https://brand.com",  "redirect404": "https://brand.com/404" } 

✏️ Update / 🗑 Delete Domains

Update: PUT https://lnky.pk/api/domain/:id/update

Delete: DELETE https://lnky.pk/api/domain/:id/delete

This lets agencies or SaaS apps let their users connect their own domains via API, which is a big upgrade in perceived value.


7. Campaigns & Channels: Organizing Links at Scale

Lnky.pk distinguishes two very useful organizing layers:

Campaigns → marketing/experiments groupings

Channels → logical groupings (clients, brands, themes, etc.)

📊 Campaigns

List campaigns:

GET https://lnky.pk/api/campaigns?limit=2&page=1

Returns an array of campaigns with:

id, name, public, rotator, list

Create a campaign:

POST https://lnky.pk/api/campaign/add

Body example:

{  "name": "Spring Launch 2026",  "slug": "spring-launch-2026",  "public": true } 

Assign a link to a campaign:

POST https://lnky.pk/api/campaign/:campaignid/assign/:linkid

This is perfect for tying specific short links to specific campaigns and then reading the performance later.


📺 Channels

Channels help you group links, bios, or QR codes under labels like:

“Client – Nike”

“Client – Local Restaurant”

“Product – Mobile App”

List channels:

GET https://lnky.pk/api/channels?limit=2&page=1

Create a channel:

POST https://lnky.pk/api/channel/add

Body example:

{  "name": "Acme Corp",  "description": "All assets for Acme Corp",  "color": "#000000",  "starred": true } 

Assign an item (link, bio, qr) to a channel:

POST https://lnky.pk/api/channel/:channelid/assign/:type/:itemid

Where:

:type is links or bio or qr

This is great for multi-client platforms, agencies, or team dashboards.


8. The Core: Creating & Managing Short Links via API

This is the endpoint you’ll likely use the most.

📋 List Links

GET https://lnky.pk/api/urls?limit=2&page=1&order=date

Options:

limit (optional) – per page

page (optional) – page number

order (optional) – date or click

short (optional) – search via a short URL and get a single link directly

🎯 Get a Single Link with Analytics

GET https://lnky.pk/api/url/:id

Response includes:

details → long URL, short URL, title, description, targeting config, expiry

data → clicks, uniqueClicks, topCountries, topReferrers, browsers, OS, social stats

This is perfect for custom analytics dashboards.


✨ Shorten a Link

POST https://lnky.pk/api/url/add

This is where Lnky.pk really shines — the payload is extremely flexible.

Key parameters include:

url (required) – long URL

custom – custom alias (e.g. “spring-sale”)

type – redirection type (direct, frame, splash, or overlay IDs)

password – password-protected links

domain – custom branded domain

expiry – link expiration (YYYY-MM-DD HH:MM:SS)

geotarget – array of country → URL overrides

devicetarget – array of device → URL overrides

languagetarget – array of language → URL overrides

metatitle, metadescription, metaimage – Open Graph metadata

pixels – array of pixel IDs to fire on click

channel – channel ID

deeplink – app deeplinks (Apple / Google)

parameters – dynamic query string parameters

This allows you to create very smart links via API: geo-based, device-based, language-based, campaign-aware, pixel-enabled.

Example (simplified):

{  "url": "https://example.com",  "custom": "spring-sale",  "expiry": "2026-04-01 23:59:59",  "metatitle": "Spring Sale 2026",  "metadescription": "Save up to 50% this spring.",  "pixels": [1, 2],  "geotarget": [    { "location": "Canada", "link": "https://example.ca" },    { "location": "United States", "link": "https://example.us" }  ] } 

Response:

{  "error": 0,  "id": 123,  "shorturl": "https://lnky.pk/spring-sale" } 


✏️ Update & 🗑 Delete Links

Update: PUT https://lnky.pk/api/url/:id/update

Delete: DELETE https://lnky.pk/api/url/:id/delete

You send the same type of JSON body as in creation — but only with fields you want to change.

This is critical when you:

Change campaign metadata

Switch targeting rules

Update pixels

Repoint a promotion


9. Pixels: Connecting Lnky.pk to Your Ad Ecosystem

Pixels let you build retargeting audiences and monitor conversions.

📃 List Pixels

GET https://lnky.pk/api/pixels?limit=2&page=1

➕ Create a Pixel

POST https://lnky.pk/api/pixel/add

Body:

type – one of gtmpixel, gapixel, fbpixel, adwordspixel, linkedinpixel, twitterpixel, adrollpixel, quorapixel, pinterest, bing, snapchat, reddit, tiktok

name – your label (e.g. “Main Facebook Pixel”)

tag – ID/tag from the ad platform

✏️ Update & 🗑 Delete

Update: PUT https://lnky.pk/api/pixel/:id/update

Delete: DELETE https://lnky.pk/api/pixel/:id/delete

Once you’ve added pixels, you can attach them to links using the pixels array when shortening or updating URLs.


10. QR Code Automation with the Lnky.pk API

Beyond simple “link QR”, Lnky.pk lets you create rich QR use cases.

📃 List QRs

GET https://lnky.pk/api/qr?limit=2&page=1

🔍 Get a Single QR + Analytics

GET https://lnky.pk/api/qr/:id

Includes:

scans count

clicks, uniqueClicks

topCountries, topReferrers, topBrowsers, topOs

socialCount

Perfect for measuring offline campaign performance.

➕ Create a QR Code

POST https://lnky.pk/api/qr/add

Parameters:

type – text, vcard, link, email, phone, sms, wifi

data – content (string or struct depending on type)

background (optional) – rgb(255,255,255)

foreground (optional) – rgb(0,0,0)

logo (optional) – logo URL (png/jpg)

Example:

{  "type": "link",  "data": "https://lnky.pk/spring-sale",  "background": "rgb(255,255,255)",  "foreground": "rgb(0,0,0)",  "logo": "https://brand.com/logo.png" } 

✏️ Update & 🗑 Delete QRs

Update: PUT https://lnky.pk/api/qr/:id/update

Delete: DELETE https://lnky.pk/api/qr/:id/delete

This is ideal for:

Dynamic menus

Event passes

Flyers & posters

Physical packaging

OOH campaigns


11. Admin-Only Power: Plans & Users (For Platforms on Top of Lnky.pk)

If you’re an admin building a multi-tenant platform, these endpoints are extremely valuable.

🧩 Plans

List plans: GET https://lnky.pk/api/plans

Subscribe a user to a plan: PUT https://lnky.pk/api/plan/:planid/user/:userid

You specify:

type: monthly, yearly, or lifetime

expiration: optional custom date

👥 Users

List users with filters (admin, free, pro): GET https://lnky.pk/api/users?filter=free

Get a single user: GET https://lnky.pk/api/user/:id

Create a user: POST https://lnky.pk/api/user/add

Delete a user: DELETE https://lnky.pk/api/user/:id/delete

Generate an SSO login URL: GET https://lnky.pk/api/user/login/:id

These capabilities make Lnky.pk suitable as a backend engine for:

Whitelabel SaaS products

Agencies reselling link tools

Enterprise platforms with multi-user plans


12. Real-World Use Cases for the Lnky.pk API in 2026

Here are some practical scenarios that show the API’s power:

🧪 1. SaaS Tool Adding Smart Links & QR

Use /url/add to generate smart links with geo/device targeting

Use /qr/add to create matching QR codes

Use channels & campaigns to group per client

📲 2. Mobile App Deep Linking

Combine deeplink + devicetarget to direct users to the correct app store

Track everything in one short link

🛒 3. E-commerce Performance Tracking

One short link per campaign / influencer

Attach pixels via pixels parameter

Use campaigns to organize by marketing initiative

🧾 4. Agency Multi-Client Management

Create a channel per client

Group links, bio pages, and QR codes under that channel

Use admin endpoints to manage user accounts & plans behind the scenes

🏪 5. Offline-to-Online Conversion Tracking

Create QR codes for menus, posters, physical stores

Track scans + clicks + browsers + OS via /qr/:id


Conclusion: Lnky.pk API = Your Link Infrastructure Layer for 2026

The Lnky.pk API is more than a “short URL generator.”

It’s a complete programmable layer for:

Links

QR codes

Pixels

Campaigns

Channels

Domains

Users & plans (admin)

Whether you’re a developer, SaaS founder, agency, growth marketer, or product team, you can plug Lnky.pk into your stack and instantly unlock:

Automation

Clean analytics

Smart routing

Retargeting

White-label possibilities

In 2026, the products that win are the ones that treat links as infrastructure, not just as text.
The Lnky.pk API gives you that infrastructure, ready to build on.

lnky.pk Free URL Shortener, Bio Pages + Analytics & QR
Try Free →

About the author

Arslan Ahmad

Arslan Ahmad

Founder of Lnky and Devstrom Solutions in Lahore. Builds simple web tools that help small businesses and creators in Pakistan sell online.