API Documentation

REST API available on Pro plan. Manage your links programmatically from any language or tool.

Authentication

Include your API token in every request using the Authorization header:

Authorization: Bearer YOUR_API_TOKEN

Generate tokens from Settings → API tokens. Tokens are shown only once — store them securely.

Base URL

https://un2.click/api/v1

All responses are JSON. All requests must include Content-Type: application/json for POST requests.

GET /api/v1/links

List links

Returns a paginated list of your links.

Parameter Type Description
page integer Page number (default: 1)
per_page integer Results per page, max 100 (default: 20)
status string Filter by status: active, paused, expired

Response

{
  "data": [
    {
      "uuid": "abc123...",
      "slug": "my-link",
      "short_url": "https://un2.click/my-link",
      "destination_url": "https://example.com",
      "title": "My campaign",
      "clicks_total": 142,
      "status": "active",
      "created_at": "2026-01-15 10:30:00"
    }
  ],
  "pagination": {
    "total": 48,
    "page": 1,
    "per_page": 20,
    "pages": 3
  }
}

POST /api/v1/links

Create link

Creates a new short link.

Parameter Type Description
destination_url string * The URL to shorten
slug string Custom slug (optional, letters/numbers/hyphens)
title string Optional label for the link
expires_at datetime Expiry date: YYYY-MM-DD HH:MM:SS
clicks_limit integer Max clicks before link deactivates
utm_source string UTM source parameter
utm_medium string UTM medium parameter
utm_campaign string UTM campaign parameter

Response

{
  "data": {
    "uuid": "abc123...",
    "slug": "my-link",
    "short_url": "https://un2.click/my-link",
    "destination_url": "https://example.com",
    "status": "active",
    "created_at": "2026-04-02 12:00:00"
  }
}

GET /api/v1/links/{slug}

Get link

Returns details for a specific link.

Response

{
  "data": {
    "uuid": "abc123...",
    "slug": "my-link",
    "short_url": "https://un2.click/my-link",
    "destination_url": "https://example.com",
    "clicks_total": 142,
    "status": "active"
  }
}

DELETE /api/v1/links/{slug}

Delete link

Permanently deletes a link.

Response

{
  "message": "Link deleted successfully."
}

GET /api/v1/stats/{slug}

Link statistics

Returns click analytics for a link.

Parameter Type Description
days integer Period in days, max 365 (default: 7)

Response

{
  "data": {
    "slug": "my-link",
    "short_url": "https://un2.click/my-link",
    "total_clicks": 142,
    "period_days": 7,
    "clicks_by_day": [
      {"date": "2026-04-01", "clicks": 23}
    ],
    "top_countries": [
      {"country": "RO", "clicks": 89}
    ],
    "top_devices": [
      {"device_type": "mobile", "clicks": 98}
    ],
    "top_referrers": [
      {"referer": "https://facebook.com", "clicks": 45}
    ]
  }
}

Error codes

200 OK Request successful
201 Created Resource created successfully
400 Bad Request Invalid request parameters
401 Unauthorized Missing or invalid API token
402 Payment Required Premium slug requires purchase
403 Forbidden Action not allowed on your plan
404 Not Found Resource not found
409 Conflict Slug already taken
422 Unprocessable Validation error

Quick example

Create a short link with cURL:

curl -X POST https://un2.click/api/v1/links \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "destination_url": "https://example.com/my-long-url",
    "title": "My campaign link",
    "utm_source": "newsletter",
    "utm_medium": "email"
  }'

JavaScript (fetch):

const response = await fetch('https://un2.click/api/v1/links', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    destination_url: 'https://example.com/my-long-url',
    title: 'My campaign link',
  }),
});

const { data } = await response.json();
console.log(data.short_url); // https://un2.click/aBcD1234
Generate API token →

Requires Pro plan. Upgrade →