enruuk
← Назад

Документация API

Используйте наш API для программного создания и управления сокращенными URL.

Конечные точки

POST /api/create

Формат запроса

Content-Type: multipart/form-data

Параметры

Имя Описание Обязательный
url The URL to shorten. Must be a valid URL that starts with http:// or https://. Да
custom_url Custom alias for the shortened URL. Only alphanumeric characters, hyphens, and underscores are allowed. Length must be between 3 and 30 characters. Нет

Пример запроса

curl -X POST -F "url=https://example.com/very/long/url/that/needs/to/be/shortened" -F "custom_url=example123" https://clck.ee/api/create

Формат ответа

Content-Type: application/json

Поля ответа

Поле Описание Тип
success Indicates if the request was successful Boolean
data Contains the response data if the request was successful Object
data.shortUrl The shortened URL String
data.statsUrl URL to access the statistics for this shortened link String
error Error message if the request failed String

Пример ответа

{
  "success": true,
  "data": {
    "shortUrl": "https://clck.ee/example123",
    "statsUrl": "https://clck.ee/en/stats/example123"
  }
}
GET /api/stats?id={shortId}

Параметры

Имя Описание Обязательный
id The ID or custom alias of the shortened URL Да

Пример запроса

curl -X GET https://clck.ee/api/stats?id=example123

Формат ответа

Content-Type: application/json

Поля ответа

Поле Описание Тип
success Indicates if the request was successful Boolean
data Contains the response data if the request was successful Object
data.link Contains information about the link Object
data.stats Contains statistics about the link Object
error Error message if the request failed String

Пример ответа

{
  "success": true,
  "data": {
    "link": {
      "id": "example123",
      "originalUrl": "https://example.com/very/long/url/that/needs/to/be/shortened",
      "createdAt": "2025-03-31T12:34:56.789Z"
    },
    "stats": {
      "totalClicks": 42,
      "humanClicks": 38,
      "botPercentage": 9.5,
      "recentVisits": [...],
      "browserStats": [...],
      "osStats": [...],
      "deviceStats": [...],
      "countryStats": [...],
      "referrerStats": [...],
      "visitsByDate": [...],
      "utmStats": [...]
    }
  }
}

Примечания

  • Для базового использования аутентификация не требуется.