API

URL Shortener API

🔑
Get your free API key
Quick sign-up · Key by email · 60 req/h included
Request access →
Test the API
Other tools URL Shortener QR Code Generator

Lejumo provides a free URL shortening API. Get your personal API key in 30 seconds — confirm your email, receive your key. 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, one free key

The Lejumo API requires a free API key sent in the Authorization: Bearer header. Get your key here — just confirm your email address, no credit card. 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" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"url":"https://www.example.com"}'

# 200 response
{
  "short":      "https://lejumo.com/abc",
  "code":       "abc",
  "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/abc

# 200 response
{
  "code":       "abc",
  "short":      "https://lejumo.com/abc",
  "clicks":     42,
  "created_at": 1781191498,
  "expires_at": 1788967498
}

# 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-key rate limiting to prevent abuse:

There is no paid tier with increased limits. If you need higher limits, contact us.

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\nAuthorization: Bearer YOUR_API_KEY\r\n",
    'content' => json_encode(['url' => 'https://www.example.com']),
  ]])
);
$data = json_decode($response, true);
echo $data['short']; // https://lejumo.com/abc

JavaScript (fetch)

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

Python

import requests

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

API comparison

Lejumo vs the leading URL shortener APIs.

Lejumo URLR.me Bitly
API key required ✓ Free Yes (paid) Yes (paid)
Sign-up required Email only Full account Full account
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. A free API key is required — get yours here by confirming your email address. The only usage constraint is 60 creations per hour per key.
Do I need an API key to use the URL shortener API?
Yes. A free API key is required. Register here — enter your email, describe your use case, solve a quick math check, then confirm your email. Your key arrives by email in seconds. Pass it as Authorization: Bearer YOUR_KEY in each request.
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 simplicity and cost. Bitly and most shortening APIs require a paid account and a complex OAuth flow. Lejumo requires only a free API key obtained by confirming your email — no credit card, no subscription.

Go further