Introduction
Manage your short urls with this API
This documentation aims to provide all the information you need to work with Shrinkly.me API.
Authenticating requests
To authenticate requests, include an Authorization
header with the value "Bearer {YOUR_AUTH_KEY}"
.
All authenticated endpoints are marked with a requires authentication
badge in the documentation below.
You can retrieve your token by visiting your dashboard and clicking Generate API token under settings.
Url management
APIs for managing Urls
List Urls
requires authentication
Example request:
curl --request GET \
--get "https://shrinkly.me/api/v1/urls?min_created_at=2024-04-01&max_created_at=2024-05-01" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}"
const url = new URL(
"https://shrinkly.me/api/v1/urls"
);
const params = {
"min_created_at": "2024-04-01",
"max_created_at": "2024-05-01",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (302):
Show headers
cache-control: no-cache, private
location: https://shrinkly.me/login
content-type: text/html; charset=UTF-8
access-control-allow-origin: *
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0;url='https://shrinkly.me/login'" />
<title>Redirecting to https://shrinkly.me/login</title>
</head>
<body>
Redirecting to <a href="https://shrinkly.me/login">https://shrinkly.me/login</a>.
</body>
</html>
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get Single Url
requires authentication
Example request:
curl --request GET \
--get "https://shrinkly.me/api/v1/urls/94" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}"
const url = new URL(
"https://shrinkly.me/api/v1/urls/94"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (302):
Show headers
cache-control: no-cache, private
location: https://shrinkly.me/login
content-type: text/html; charset=UTF-8
access-control-allow-origin: *
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0;url='https://shrinkly.me/login'" />
<title>Redirecting to https://shrinkly.me/login</title>
</head>
<body>
Redirecting to <a href="https://shrinkly.me/login">https://shrinkly.me/login</a>.
</body>
</html>
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Get Url Visits or clicks
requires authentication
Example request:
curl --request GET \
--get "https://shrinkly.me/api/v1/urls/96/visits" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}"
const url = new URL(
"https://shrinkly.me/api/v1/urls/96/visits"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (302):
Show headers
cache-control: no-cache, private
location: https://shrinkly.me/login
content-type: text/html; charset=UTF-8
access-control-allow-origin: *
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0;url='https://shrinkly.me/login'" />
<title>Redirecting to https://shrinkly.me/login</title>
</head>
<body>
Redirecting to <a href="https://shrinkly.me/login">https://shrinkly.me/login</a>.
</body>
</html>
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Shrink a Url
requires authentication
Example request:
curl --request POST \
"https://shrinkly.me/api/v1/urls" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--data "{
\"url\": \"https:\\/\\/linkedin.com\",
\"alias\": \"abc123\",
\"password\": \"12345\",
\"access_action\": \"allow\",
\"countries\": \"[\\\"US\\\",\\\"IN\\\"]\"
}"
const url = new URL(
"https://shrinkly.me/api/v1/urls"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"url": "https:\/\/linkedin.com",
"alias": "abc123",
"password": "12345",
"access_action": "allow",
"countries": "[\"US\",\"IN\"]"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 8,
"user_id": 11,
"short": "shrinkly.me/UYZCAi",
"long": "https://www.quigley.com/beatae-rem-non-excepturi-vero-minima-ut-molestias",
"status": "enabled",
"password": null,
"access_action": null,
"access_countries": null,
"created_at": "2024-11-25T16:49:50.000000Z"
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Delete Url
requires authentication
Example request:
curl --request DELETE \
"https://shrinkly.me/api/v1/urls/97" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}"
const url = new URL(
"https://shrinkly.me/api/v1/urls/97"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Update a Url
requires authentication
Example request:
curl --request PUT \
"https://shrinkly.me/api/v1/urls/94" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--data "{
\"url\": \"https:\\/\\/linkedin.com\",
\"alias\": \"abc123\",
\"password\": \"12345\",
\"access_action\": \"block\",
\"countries\": \"[\\\"US\\\",\\\"IN\\\"]\"
}"
const url = new URL(
"https://shrinkly.me/api/v1/urls/94"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"url": "https:\/\/linkedin.com",
"alias": "abc123",
"password": "12345",
"access_action": "block",
"countries": "[\"US\",\"IN\"]"
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.