REST API
Create short links, read click statistics and generate QR codes from your own code. JSON over HTTPS and a single header for authentication.
- Base URL
- https://urlik.xyz/api/
- Authentication
- X-Api-Key
- Format
- JSON · UTF-8
- Methods
- 10
- Webhooks
- Webhooks
Quickstart
Your first short link in one request.
Get a key
Create it in your account under API. Keys can be limited to specific scopes.
Send the request
POST the long URL with the X-Api-Key header, and an alias if you want one.
Use the result
return.url is the short link, return.qr its QR code and return.stats the public statistics page.
Your first request
curl -X POST https://urlik.xyz/api/getLink.json \ -H "X-Api-Key: $URLIK_KEY" \ -d "url=https://example.com/spring-sale" \ -d "alias=spring" \ -d "mode=redirect"
const res = await fetch("https://urlik.xyz/api/getLink.json", {
method: "POST",
headers: { "X-Api-Key": process.env.URLIK_KEY },
body: new URLSearchParams({ url: "https://example.com/spring-sale", alias: "spring" })
});
const data = await res.json();
console.log(data.return.url); // https://urlik.xyz/spring$ch = curl_init("https://urlik.xyz/api/getLink.json");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("URLIK_KEY")],
CURLOPT_POSTFIELDS => ["url" => "https://example.com/spring-sale", "alias" => "spring"],
CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
echo $data["return"]["url"]; // https://urlik.xyz/springimport os, requests
r = requests.post(
"https://urlik.xyz/api/getLink.json",
headers={"X-Api-Key": os.environ["URLIK_KEY"]},
data={"url": "https://example.com/spring-sale", "alias": "spring"},
)
print(r.json()["return"]["url"]) # https://urlik.xyz/spring{
"status": "success",
"return": {
"hex": "spring",
"url": "https://urlik.xyz/spring",
"qr": "https://urlik.xyz/qr/spring.png",
"stats": "https://urlik.xyz/spring+",
"mode": "redirect"
}
}Authentication
Send your key in the X-Api-Key header. Basic shortening works without a key; links created with a key belong to your account.
Response format
Every method answers with JSON: status is success or error, message explains an error, return holds the data.
{ "status": "success", "message": "...", "return": { ... } }Links
POST/api/getLink.jsonCreate a short linkKey optional
| Parameter | Required | Description |
|---|---|---|
url | required | Destination URL, http or https |
alias | optional | Custom code, 2–32 characters: letters, digits, _ and - |
mode | optional | redirect (default), preview or frame |
expire | optional | Lifetime in seconds, 0 means no expiry |
password | optional | Password visitors must enter to continue |
curl -X POST https://urlik.xyz/api/getLink.json -H "X-Api-Key: $URLIK_KEY" \ -d "url=https://example.com/spring-sale"
const res = await fetch("https://urlik.xyz/api/getLink.json", {
method: "POST",
headers: { "X-Api-Key": process.env.URLIK_KEY },
body: new URLSearchParams({ url: "https://example.com/spring-sale" })
});
console.log(await res.json());$ch = curl_init("https://urlik.xyz/api/getLink.json");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("URLIK_KEY")],
CURLOPT_POSTFIELDS => ["url" => "https://example.com/spring-sale"],
CURLOPT_RETURNTRANSFER => true,
]);
print_r(json_decode(curl_exec($ch), true));import os, requests
r = requests.post(
"https://urlik.xyz/api/getLink.json",
headers={"X-Api-Key": os.environ["URLIK_KEY"]},
data={"url": "https://example.com/spring-sale"},
)
print(r.json())POST/api/stats.jsonLink statistics: clicks by day, sources, devices and browsersKey optional
| Parameter | Required | Description |
|---|---|---|
code | required | Short code of the link |
curl -X POST https://urlik.xyz/api/stats.json -H "X-Api-Key: $URLIK_KEY" \ -d "code=spring"
const res = await fetch("https://urlik.xyz/api/stats.json", {
method: "POST",
headers: { "X-Api-Key": process.env.URLIK_KEY },
body: new URLSearchParams({ code: "spring" })
});
console.log(await res.json());$ch = curl_init("https://urlik.xyz/api/stats.json");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("URLIK_KEY")],
CURLOPT_POSTFIELDS => ["code" => "spring"],
CURLOPT_RETURNTRANSFER => true,
]);
print_r(json_decode(curl_exec($ch), true));import os, requests
r = requests.post(
"https://urlik.xyz/api/stats.json",
headers={"X-Api-Key": os.environ["URLIK_KEY"]},
data={"code": "spring"},
)
print(r.json())POST/api/links.jsonList your linksKey required
No parameters: the key identifies your account.
curl -X POST https://urlik.xyz/api/links.json -H "X-Api-Key: $URLIK_KEY"
const res = await fetch("https://urlik.xyz/api/links.json", {
method: "POST",
headers: { "X-Api-Key": process.env.URLIK_KEY },
body: new URLSearchParams({ })
});
console.log(await res.json());$ch = curl_init("https://urlik.xyz/api/links.json");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("URLIK_KEY")],
CURLOPT_POSTFIELDS => [],
CURLOPT_RETURNTRANSFER => true,
]);
print_r(json_decode(curl_exec($ch), true));import os, requests
r = requests.post(
"https://urlik.xyz/api/links.json",
headers={"X-Api-Key": os.environ["URLIK_KEY"]},
data={},
)
print(r.json())POST/api/update.jsonChange a linkKey required
| Parameter | Required | Description |
|---|---|---|
code | required | Short code of the link |
url, mode, expire, password | optional | New values of the fields you want to change |
curl -X POST https://urlik.xyz/api/update.json -H "X-Api-Key: $URLIK_KEY" \ -d "code=spring"
const res = await fetch("https://urlik.xyz/api/update.json", {
method: "POST",
headers: { "X-Api-Key": process.env.URLIK_KEY },
body: new URLSearchParams({ code: "spring" })
});
console.log(await res.json());$ch = curl_init("https://urlik.xyz/api/update.json");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("URLIK_KEY")],
CURLOPT_POSTFIELDS => ["code" => "spring"],
CURLOPT_RETURNTRANSFER => true,
]);
print_r(json_decode(curl_exec($ch), true));import os, requests
r = requests.post(
"https://urlik.xyz/api/update.json",
headers={"X-Api-Key": os.environ["URLIK_KEY"]},
data={"code": "spring"},
)
print(r.json())POST/api/delete.jsonDelete a linkKey required
| Parameter | Required | Description |
|---|---|---|
code | required | Short code of the link |
curl -X POST https://urlik.xyz/api/delete.json -H "X-Api-Key: $URLIK_KEY" \ -d "code=spring"
const res = await fetch("https://urlik.xyz/api/delete.json", {
method: "POST",
headers: { "X-Api-Key": process.env.URLIK_KEY },
body: new URLSearchParams({ code: "spring" })
});
console.log(await res.json());$ch = curl_init("https://urlik.xyz/api/delete.json");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("URLIK_KEY")],
CURLOPT_POSTFIELDS => ["code" => "spring"],
CURLOPT_RETURNTRANSFER => true,
]);
print_r(json_decode(curl_exec($ch), true));import os, requests
r = requests.post(
"https://urlik.xyz/api/delete.json",
headers={"X-Api-Key": os.environ["URLIK_KEY"]},
data={"code": "spring"},
)
print(r.json())Media, QR and temporary mail
These methods need the X-Api-Key header or a call through RapidAPI.
GET/api/download.jsonDownload video or photo from 1000+ sites: formats with signed download linksKey required
| Parameter | Required | Description |
|---|---|---|
url | required | Address of a page with video or photo |
curl -H "X-Api-Key: $URLIK_KEY" "https://urlik.xyz/api/download.json?url=https%3A%2F%2Fexample.com%2Fspring-sale"
const res = await fetch("https://urlik.xyz/api/download.json?" + new URLSearchParams({ url: "https://example.com/spring-sale" }), {
headers: { "X-Api-Key": process.env.URLIK_KEY }
});
console.log(await res.json());$ch = curl_init("https://urlik.xyz/api/download.json?" . http_build_query(["url" => "https://example.com/spring-sale"]));
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("URLIK_KEY")],
CURLOPT_RETURNTRANSFER => true,
]);
print_r(json_decode(curl_exec($ch), true));import os, requests
r = requests.get(
"https://urlik.xyz/api/download.json",
headers={"X-Api-Key": os.environ["URLIK_KEY"]},
params={"url": "https://example.com/spring-sale"},
)
print(r.json())GET/api/qr.jsonGenerate a QR code in PNG or SVGKey required
| Parameter | Required | Description |
|---|---|---|
data | required | Text or address to encode |
format | optional | png or svg |
fg, bg | optional | Foreground and background colour, hex |
ecc | optional | Error correction: L, M, Q or H |
size | optional | Image size in pixels |
curl -H "X-Api-Key: $URLIK_KEY" "https://urlik.xyz/api/qr.json?data=https%3A%2F%2Furlik.xyz"
const res = await fetch("https://urlik.xyz/api/qr.json?" + new URLSearchParams({ data: "https://urlik.xyz" }), {
headers: { "X-Api-Key": process.env.URLIK_KEY }
});
console.log(await res.json());$ch = curl_init("https://urlik.xyz/api/qr.json?" . http_build_query(["data" => "https://urlik.xyz"]));
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("URLIK_KEY")],
CURLOPT_RETURNTRANSFER => true,
]);
print_r(json_decode(curl_exec($ch), true));import os, requests
r = requests.get(
"https://urlik.xyz/api/qr.json",
headers={"X-Api-Key": os.environ["URLIK_KEY"]},
params={"data": "https://urlik.xyz"},
)
print(r.json())GET/api/mailbox.jsonGet or create a temporary addressKey required
| Parameter | Required | Description |
|---|---|---|
address | username | optional | Temporary address or the name for a new one; empty creates a random address |
curl -H "X-Api-Key: $URLIK_KEY" "https://urlik.xyz/api/mailbox.json?address=demo%40example.com"
const res = await fetch("https://urlik.xyz/api/mailbox.json?" + new URLSearchParams({ address: "[email protected]" }), {
headers: { "X-Api-Key": process.env.URLIK_KEY }
});
console.log(await res.json());$ch = curl_init("https://urlik.xyz/api/mailbox.json?" . http_build_query(["address" => "[email protected]"]));
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("URLIK_KEY")],
CURLOPT_RETURNTRANSFER => true,
]);
print_r(json_decode(curl_exec($ch), true));import os, requests
r = requests.get(
"https://urlik.xyz/api/mailbox.json",
headers={"X-Api-Key": os.environ["URLIK_KEY"]},
params={"address": "[email protected]"},
)
print(r.json())GET/api/messages.jsonList messages in a temporary inboxKey required
| Parameter | Required | Description |
|---|---|---|
address | required | Temporary address |
curl -H "X-Api-Key: $URLIK_KEY" "https://urlik.xyz/api/messages.json?address=demo%40example.com"
const res = await fetch("https://urlik.xyz/api/messages.json?" + new URLSearchParams({ address: "[email protected]" }), {
headers: { "X-Api-Key": process.env.URLIK_KEY }
});
console.log(await res.json());$ch = curl_init("https://urlik.xyz/api/messages.json?" . http_build_query(["address" => "[email protected]"]));
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("URLIK_KEY")],
CURLOPT_RETURNTRANSFER => true,
]);
print_r(json_decode(curl_exec($ch), true));import os, requests
r = requests.get(
"https://urlik.xyz/api/messages.json",
headers={"X-Api-Key": os.environ["URLIK_KEY"]},
params={"address": "[email protected]"},
)
print(r.json())GET/api/message.jsonRead a single messageKey required
| Parameter | Required | Description |
|---|---|---|
address | required | Temporary address |
id | required | Message id from the inbox list |
curl -H "X-Api-Key: $URLIK_KEY" "https://urlik.xyz/api/message.json?address=demo%40example.com&id=1"
const res = await fetch("https://urlik.xyz/api/message.json?" + new URLSearchParams({ address: "[email protected]", id: "1" }), {
headers: { "X-Api-Key": process.env.URLIK_KEY }
});
console.log(await res.json());$ch = curl_init("https://urlik.xyz/api/message.json?" . http_build_query(["address" => "[email protected]", "id" => "1"]));
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("URLIK_KEY")],
CURLOPT_RETURNTRANSFER => true,
]);
print_r(json_decode(curl_exec($ch), true));import os, requests
r = requests.get(
"https://urlik.xyz/api/message.json",
headers={"X-Api-Key": os.environ["URLIK_KEY"]},
params={"address": "[email protected]", "id": "1"},
)
print(r.json())Nothing found
No method matches this search. Try a path such as qr or stats.
Try it live
Explore and call every endpoint right here. Paste your API key with the Authorize button to run authenticated requests.
Embed the shortener
Drop this snippet on any page to add a working URL shortener with a link back to urlik.xyz:
<iframe src="https://urlik.xyz/embed" style="width:100%;max-width:520px;height:150px;border:0" title="URL shortener by urlik.xyz" loading="lazy"></iframe>
A simple REST API for short links
The Urlik REST API lets you create, read, update and delete short links from your own code and pull click statistics as JSON. It is a plain HTTPS API — send a POST request, get a predictable JSON response — so it works from any language or platform.
Basic shortening needs no credentials. To attach links to your account and manage them later, send your key in the X-Api-Key header, which you will find in your account. Responses always follow the same status, message and return shape shown below.
Do I need an API key?
Not for basic shortening — you can create a link anonymously. A key, found in your account, ties links to you and is required to list, update or delete them.
What format are responses in?
Every endpoint returns JSON with a status, a human-readable message and a return object holding the data, so parsing is consistent across calls.
Is there a rate limit?
Yes, requests are rate-limited per caller to keep the service fast and fair. Authenticated keys get a higher allowance than anonymous traffic.
Can I use it from any language?
Yes. It is a standard HTTPS JSON API, so anything that can send a POST request — curl, Python, PHP, JavaScript or Go — can use it.
Urlik brings together a set of fast, privacy-friendly web tools in one place, so you can handle everyday link tasks without juggling separate services or creating accounts. Whether you are sharing a campaign, collecting a payment, verifying a sign-up or sending a confidential file, there is a dedicated, free tool ready for the job.