API Documentation

Shorten links from your own apps and scripts

Quick start

  1. Sign in and open My Profile, then generate a token in the API Token section.
  2. Send a POST request with your token and the long URL.
  3. Read data.short_url from 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_urlThe short link to share.
short_codeThe code at the end of the short link.
original_urlWhere the short link goes, after https:// was added if needed.
titleThe title you sent, or null.
password_protectedtrue if you set a password.
created_atWhen the link was created (ISO 8601, UTC).
expires_atWhen the link stops working: one year after it was created (ISO 8601, UTC).
shortenedtrue when a short link was created, false when you're out of links (see below).
limit_reachedtrue if your account has no links left.
link_limitYour link limit: limit, used and remaining. limit and remaining are null if you have no limit.

Code examples

Replace slk_your_token_here with your own token.

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"}'
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);
}
$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"];
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
201The link was created.
200You're out of links: your original URL is returned and limit_reached is true. More
401The token is missing, wrong or has been revoked.
403Your account has been deactivated by an administrator.
422Something in the request isn't valid, e.g. a bad URL or a short code that's already taken. See errors.
429Too many requests. Wait a minute and try again.
500Something 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:// or https:// 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.x or 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 login or admin.
  • 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.