Developers
API Documentation
Integrate 4Srt directly into your application. Our REST API allows you to create, manage, and track short links programmatically.
Endpoints
POST
/api/linksCreate a new short link.
Request Body
{
"url": "https://example.com",
"slug": "custom-alias",
"password": "optional-password"
}Response
{
"success": true,
"slug": "custom-alias",
"shortUrl": "https://4srt.me/custom-alias"
}GET
/api/links/{slug}/statsGet statistics for a specific short link.
Response
{
"success": true,
"visits": 124,
"createdAt": "2024-02-20T10:00:00Z"
}Quick Example (Node.js)
const response = await fetch('https://4srt.me/api/links', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
url: 'https://google.com'
})
});
const data = await response.json();
console.log(data.shortUrl);