Shorten Magic API
Create, list, edit and delete your short links from your own code. Every request uses a personal API key from your dashboard.
Authentication
Create a key under Dashboard → API keys and send it in the Authorization header. Keys start with sb_live_. Keep them secret: anyone with your key can manage your links. Creating and editing links requires an active plan.
Authorization: Bearer sb_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxIf your server strips the Authorization header, send the key as X-Api-Key: sb_live_… instead.
Base URL:
https://www.shortenmagic.com/api/v1Errors
Every response is JSON with an ok field. Errors look like {"ok": false, "error": "…"}.
| Code | Meaning |
|---|---|
| 400 | Invalid URL, alias or domain. |
| 401 | Missing or invalid API key. |
| 402 | No active plan, or your plan's link limit is reached. |
| 404 | The link doesn't exist or isn't yours. |
| 409 | The custom alias is already taken. |
Account
Returns your plan status, usage in the last 30 days and the domains you can use.
Create a link
| Field | Type | Description |
|---|---|---|
| url | string | Required. The destination URL. |
| alias | string | Optional custom ending, 3–30 characters: letters, numbers, - and _. |
| domain | string | Optional. One of shortenbuster.com, shortenmagic.com. Defaults to the domain you call. |
curl -X POST https://www.shortenmagic.com/api/v1/links \
-H "Authorization: Bearer $SB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://examplestore.com/campaign","alias":"fallsale"}'{
"ok": true,
"link": {
"code": "fallsale",
"short_url": "https://www.shortenmagic.com/fallsale",
"url": "https://examplestore.com/campaign",
"domain": "shortenmagic.com",
"clicks": 0,
"created_at": "2026-10-19T12:00:00+00:00",
"last_click_at": null
}
}List links
Newest first. per_page can be up to 100. Keep requesting until meta.next_page is null.
Get a link
Returns one of your links with its click count.
Update a link
Send {"url": "…"} to change where the link points. The short link itself stays the same.
curl -X PATCH https://www.shortenmagic.com/api/v1/links/fallsale \
-H "Authorization: Bearer $SB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://examplestore.com/winter-campaign"}'Delete a link
The short link stops working immediately.
PHP
$ch = curl_init('https://www.shortenmagic.com/api/v1/links');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SB_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['url' => 'https://examplestore.com/campaign']),
]);
$res = json_decode(curl_exec($ch), true);
echo $res['link']['short_url'] ?? $res['error'];JavaScript (server side)
const res = await fetch('https://www.shortenmagic.com/api/v1/links', {
method: 'POST',
headers: { 'Authorization': `Bearer ${process.env.SB_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ url: 'https://examplestore.com/campaign' })
});
const data = await res.json();
console.log(data.link.short_url);Call the API from your server, not from a browser page, so your key stays private.