API

Free URL Shortener API

Test the API — Enter a URL
Other tools URL Shortener QR Code Generator

Lejumo provides a free, keyless URL shortening API. It exposes two endpoints: POST /api/shorten to create a link valid for 90 days, GET /api/stats/{code} to check the click count. Links created via the API can be renewed for an additional 90 days by calling the same endpoint between day 60 and day 90.

Two endpoints, zero sign-up

The Lejumo API requires no account, no API key, and no authorization header. Just send a standard HTTP request to get a short link in under a second. The two available endpoints cover the essentials: creating a short link and checking its click statistics. The API accepts requests from any origin (CORS *), allowing you to call it directly from a browser in client-side JavaScript.

Create a short link — POST /api/shorten

Send a POST request with a JSON body containing the url field. The created link is valid for 90 days. If you call the same endpoint with the same URL between day 60 and day 90, the validity is extended by an additional 90 days (automatic renewal).

curl -X POST https://www.lejumo.com/api/shorten \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.example.com"}'

# 200 response
{
  "short":      "https://lejumo.com/abc123",
  "code":       "abc123",
  "expires_at": 1796000000,
  "renewed":    false
}

The expires_at field is a Unix timestamp (seconds). The renewed field is true if the request triggered a renewal of the validity period.

Check click stats — GET /api/stats/{code}

Retrieve the number of recorded clicks for a short link by passing its code in the URL path. Statistics are anonymous: no personal data about visitors is collected.

curl https://www.lejumo.com/api/stats/abc123

# 200 response
{
  "code":   "abc123",
  "clicks": 42,
  "short":  "https://lejumo.com/abc123"
}

# 404 response (unknown or expired code)
{
  "error": "not_found"
}

Automatic renewal: how to extend your links

Links created via the API have a fixed validity period of 90 days. To prevent expiration, the API includes a renewal mechanism: if you call POST /api/shorten again with the same URL between day 60 and day 90, the counter resets to 90 days from the date of the request. The renewed field in the response will then be true.

This renewal window (day 60 to day 90) allows you to automate extension via a cron job or scheduled task, without creating duplicates. Outside this window (before day 60), the request simply returns the existing link without modifying its expiration date.

Rate limits

The API applies per-IP rate limiting to prevent abuse:

These limits apply to all clients, whether they use the web interface or the API directly. There is no paid tier with increased limits.

Integration examples

Ready-to-use examples for the most common languages.

PHP

<?php
$response = file_get_contents('https://www.lejumo.com/api/shorten', false,
  stream_context_create(['http' => [
    'method'  => 'POST',
    'header'  => "Content-Type: application/json\r\n",
    'content' => json_encode(['url' => 'https://www.example.com']),
  ]])
);
$data = json_decode($response, true);
echo $data['short']; // https://lejumo.com/abc123

JavaScript (fetch)

const res = await fetch('https://www.lejumo.com/api/shorten', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ url: 'https://www.example.com' }),
});
const data = await res.json();
console.log(data.short); // https://lejumo.com/abc123

Python

import requests

resp = requests.post(
    'https://www.lejumo.com/api/shorten',
    json={'url': 'https://www.example.com'}
)
data = resp.json()
print(data['short'])  # https://lejumo.com/abc123

API comparison

Lejumo vs the leading URL shortener APIs.

Lejumo URLR.me Bitly
API key required ✕ No Yes Yes
Sign-up required ✕ No Yes Yes
Price Free Paid Paid
Stats endpoint ✓ Included ✓ Included ✓ Included
Automatic renewal ✓ Day 60–90 No No

Frequently asked questions

Is the Lejumo URL shortener API truly free?
Yes, the API is entirely free, with no subscription or paid tier. It is accessible without an API key or sign-up. The only constraint is per-IP rate limiting (5 creations per hour) to prevent abuse.
Do I need an API key to use the free URL shortener API?
No. The Lejumo API does not use authentication keys. Simply send a POST request to /api/shorten with a JSON body containing the url field. No Authorization header is required.
Can I call the URL shortener API from a browser (client-side JavaScript)?
Yes. The API is configured with Access-Control-Allow-Origin: * (open CORS), which allows calling it directly from a browser via fetch() or XMLHttpRequest, without any server-side proxy.
What happens if I send the same URL twice to the API?
If you send the same URL a second time before day 60, the API returns the existing short link without modifying its expiration date. Between day 60 and day 90, the validity is extended by an additional 90 days and the renewed field in the response is true.
Are links created via the API permanent?
Links created via the API have a fixed duration of 90 days — they are not permanent. For permanent links, use the web interface of the shortener which offers a "Permanent" option. The API favours 90-day links with renewal for automated use cases.
How do I integrate this API in a PHP script or cron job?
Add a POST /api/shorten call to your deployment script or cron job. To keep your links active, schedule a recall between day 60 and day 90 after the initial creation. The PHP, JavaScript, and Python examples on this page are directly reusable.
Is my data hosted in France?
Yes. The Lejumo infrastructure is hosted in France. No personal data from visitors is collected or transmitted to third parties. Click statistics are anonymous and aggregated as a simple counter.
What is the difference between the Lejumo API and a classic shortener API like Bitly?
The main difference is the absence of an API key and sign-up. Bitly and most shortening APIs require creating an account and obtaining an OAuth token or API key. Lejumo removes this friction: a single HTTP request is enough to create a short link, with no prior setup.

Go further