Developers

API Documentation

Integrate 4Srt directly into your application. Our REST API allows you to create, manage, and track short links programmatically.

Authentication

All API requests must be authenticated using an API key sent in the x-api-key header.

Log in to view and manage your API keys.

Sign In

Endpoints

POST/api/links

Create 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}/stats

Get 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);