Safelink
API
Use Safelink programmatically
Clean URLs
Remove tracking parameters from any URL.
GET Request
curl "https://safelink-ashy.vercel.app/api/clean?url=https://example.com/?utm_source=newsletter"
POST Request
curl -X POST https://safelink-ashy.vercel.app/api/clean -H "Content-Type: application/json" -d '{"url": "https://example.com/?utm_source=newsletter"}'Response
{
"original": "https://example.com/?utm_source=newsletter",
"cleaned": "https://example.com/"
}Find Alternative Frontends
Get privacy-friendly alternative frontends for popular services like YouTube, Twitter, and Reddit.
GET Request
curl "https://safelink-ashy.vercel.app/api/alt?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ"
POST Request
curl -X POST https://safelink-ashy.vercel.app/api/alt -H "Content-Type: application/json" -d '{"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"}'Response (when found)
{
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"service": "YouTube",
"alternative": "https://invidious.example.com/watch?v=dQw4w9WgXcQ",
"isCustomFrontend": true
}isCustomFrontend is truewhen the result comes from a custom override rather than the LibRedirect dataset.
Response (when not found)
{
"url": "https://example.com",
"alternative": null,
"message": "No alternative frontend found for this URL"
}JavaScript Example
Clean a URL
async function cleanUrl(url) {
const response = await fetch(
'https://safelink-ashy.vercel.app/api/clean?url=' + encodeURIComponent(url)
);
const data = await response.json();
return data.cleaned;
}
// Usage
const cleaned = await cleanUrl('https://example.com/?utm_source=test');
console.log(cleaned);Find alternative frontend
async function findAlternative(url) {
const response = await fetch('https://safelink-ashy.vercel.app/api/alt', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ url })
});
const data = await response.json();
return data.alternative;
}
// Usage
const altUrl = await findAlternative('https://youtube.com/watch?v=...');
if (altUrl) console.log(altUrl);CORS Enabled
All API endpoints send Access-Control-Allow-Origin: *, so you can call them directly from any website or application.
Additional Endpoints
/api/clearurlsGet the raw ClearURLs rules dataset.
/api/alternative-frontendsGet the raw alternative frontends dataset.