Quick start
- Sign in and open My Profile, then generate a token in the API Token section.
- Send a
POSTrequest with your token and the long URL. - Read
data.short_urlfrom the response.
Base URL
https://www.lnq.info/api/v1
Format
JSON requests and responses
Authentication
Every request must send your API token in the Authorization header:
Authorization: Bearer slk_your_token_here
- Each account has one token. Links you create with it belong to your account and appear in your dashboard.
- The token is shown only once, when you generate it. If you lose it, generate a new one; the old one stops working immediately.
- Keep it secret: anyone with your token can create links as you. Don't put it in public code or in web pages.
- You can revoke it at any time from My Profile.
Shorten a link
POST https://www.lnq.info/api/v1/links
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| url | string | Yes | The long URL to shorten, up to 2,048 characters. If you leave out https://, it's added for you. |
| title | string | No | A label to help you find the link in your dashboard. Not shown to visitors. Max 255 characters. |
| short_code | string | No | Your own code, e.g. summer-sale. English letters, numbers, - and _, max 20. If you leave it out, a random 6-character code is generated. |
| password | string | No | Visitors must enter this password before being redirected. At least 4 characters. |
Response 201 Created
{
"data": {
"short_url": "https://www.lnq.info/aB3xY9",
"short_code": "aB3xY9",
"original_url": "https://example.com/a/very/long/page",
"title": null,
"password_protected": false,
"created_at": "2026-09-30T12:00:00+00:00",
"expires_at": "2027-09-30T12:00:00+00:00",
"shortened": true
},
"limit_reached": false,
"link_limit": {
"limit": 50,
"used": 13,
"remaining": 37
}
}
| short_url | The short link to share. |
| short_code | The code at the end of the short link. |
| original_url | Where the short link goes, after https:// was added if needed. |
| title | The title you sent, or null. |
| password_protected | true if you set a password. |
| created_at | When the link was created (ISO 8601, UTC). |
| expires_at | When the link stops working: one year after it was created (ISO 8601, UTC). |
| shortened | true when a short link was created, false when you're out of links (see below). |
| limit_reached | true if your account has no links left. |
| link_limit | Your link limit: limit, used and remaining. limit and remaining are null if you have no limit. |
When you're out of links
Your account may have a limit on how many links it can have. When you've used them all, the API
doesn't return an error: it answers 200
with your original URL in short_url, so your app can keep working, and
sets limit_reached to true.
No link is created.
{
"data": {
"short_url": "https://example.com/a/very/long/page",
"short_code": null,
"original_url": "https://example.com/a/very/long/page",
"shortened": false
},
"limit_reached": true,
"message": "You've reached your limit of 50 links. Delete a link or ask an administrator to raise your limit.",
"link_limit": {
"limit": 50,
"used": 50,
"remaining": 0
}
}
- Check
limit_reached(ordata.shortened) to know whether you got a short link. - Deleting one of your links frees up space. An administrator can also raise your limit.
- The URL is still checked: an invalid URL returns 422 as usual.
Code examples
Replace slk_your_token_here with your own token.
curl
curl -X POST "https://www.lnq.info/api/v1/links" \
-H "Authorization: Bearer slk_your_token_here" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"url": "https://example.com/a/very/long/page?ref=newsletter"}'
JavaScript
const response = await fetch("https://www.lnq.info/api/v1/links", {
method: "POST",
headers: {
"Authorization": "Bearer slk_your_token_here",
"Content-Type": "application/json",
"Accept": "application/json",
},
body: JSON.stringify({ url: "https://example.com/a/very/long/page" }),
});
const result = await response.json();
if (response.ok) {
console.log(result.data.short_url);
} else {
console.error(result.message, result.errors);
}
PHP
$ch = curl_init("https://www.lnq.info/api/v1/links");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer slk_your_token_here",
"Content-Type: application/json",
"Accept: application/json",
],
CURLOPT_POSTFIELDS => json_encode(["url" => "https://example.com/a/very/long/page"]),
]);
$result = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status === 201 ? $result["data"]["short_url"] : $result["message"];
Python
import requests
response = requests.post(
"https://www.lnq.info/api/v1/links",
headers={"Authorization": "Bearer slk_your_token_here", "Accept": "application/json"},
json={"url": "https://example.com/a/very/long/page"},
)
result = response.json()
if response.status_code == 201:
print(result["data"]["short_url"])
else:
print(result["message"], result.get("errors"))
Errors
Errors come back as JSON with a message. Validation errors also list what's wrong with each field in errors.
| Status | Meaning |
|---|---|
| 201 | The link was created. |
| 200 | You're out of links: your original URL is returned and limit_reached is true. More |
| 401 | The token is missing, wrong or has been revoked. |
| 403 | Your account has been deactivated by an administrator. |
| 422 | Something in the request isn't valid, e.g. a bad URL or a short code that's already taken. See errors. |
| 429 | Too many requests. Wait a minute and try again. |
| 500 | Something went wrong on our side. Please try again later. |
Example 422
{
"message": "The link must include a domain ending, like \"example.com\" (e.g. https://example.com).",
"errors": {
"url": [
"The link must include a domain ending, like \"example.com\" (e.g. https://example.com)."
]
}
}
Limits & rules
- Up to 60 requests per minute per account.
- The same rules as the dashboard apply:
- The URL must be a full
http://orhttps://link with a real domain ending, like.com. - Links to this site itself can't be shortened.
- Local network links (like
localhost,192.168.x.xor internal host names) only work if an administrator has allowed them for your account. - Short codes must be unique and can't match the site's own pages, like
loginoradmin.
- The URL must be a full
- Links created with the API count towards your account's link limit, and are tracked like any other link: you'll see their clicks and visitors in your dashboard.
- Your account may also have a click limit: each of your links stops working once it reaches that many visits.
- Every link expires one year after it was created. After that, visitors see a message that the link has expired.
- Use of the API is covered by our Terms & Conditions.