Short your Link

fetch('https://justanotherlinkcut.com/api/shorten', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        // Bearer token is OPTIONAL, If you are Authenticate save you ID,
        'Authorization': 'Bearer /* YOUR_ACCESS_TOKEN_HERE */', // Pass BearerToken via Authorization header
    },
    body: JSON.stringify({
        "original_url" : "https://www.youtube.com/",
        "expired_at": "" // false or null
    })
.then(res => res.json())
.then(console.log);
{
    "Messages": "Create Correct URL",
    "shortCode": "https://justanotherlinkcut.com/ABC123"
}

Login User and Get Bearer Token

fetch('https://justanotherlinkcut.com/api/login', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      email: 'useremail',
      password: 'userspass',
    }),
.then(res => res.json())
.then(console.log);
{
    "user": {
        "id": 1,
        "name": "My User",
        "email": "user@email.com",
        "email_verified_at": null,
        "created_at": "2024-11-14T20:44:14.000000Z",
        "updated_at": "2024-11-19T14:32:09.000000Z"
    },
    "token": "4|Y37WlbFbViBloQMV05LgETYO..."
}

Get User

fetch('https://justanotherlinkcut.com/api/user', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer /* YOUR_ACCESS_TOKEN_HERE */', // Pass BearerToken via Authorization header
    },
.then(res => res.json())
.then(console.log);
{
    "id": 1,
    "name": "My User",
    "email": "user@email.com",
    "email_verified_at": null,
    "created_at": "2024-11-14T20:44:14.000000Z",
    "updated_at": "2024-11-19T14:32:09.000000Z"
}

Get User Links

fetch('https://justanotherlinkcut.com/api/getUserLinks', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer /* YOUR_ACCESS_TOKEN_HERE */', // Pass BearerToken via Authorization header
    },
.then(res => res.json())
.then(console.log);
{
   "links": [
        {
            "id": 365,
            "original_url": "http://urloriginal.com",
            "short_code": "ABC123",
            "expires_at": null, // by default expired in 48 hs.
            "user_id": 99,
            "created_at": "2024-08-15T12:12:40.000000Z",
            "updated_at": "2024-08-15T12:12:40.000000Z"
        },
        {...},
        {...},
    ]
}

Get User Link Tracking

fetch('https://justanotherlinkcut.com/api/getUserLinkTracking', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer /* YOUR_ACCESS_TOKEN_HERE */', // Pass BearerToken via Authorization header
    },
    body: JSON.stringify({
        selectDays: 90  // 7, 30, 90 days
    })
.then(res => res.json())
.then(console.log);
{
    "totalClicksPorDia": {
        "total_clicks": 3
    },
    "objClicksPorDia": {
        "labels": [
            "2024-11-15",
            "2024-12-03"
        ],
        "data": [
            1,
            2
        ]
    },
    "objClicksPorDispositivo": {
        "labels": [
            "desktop"
        ],
        "data": [
            3
        ]
    },
    "objClicksPorPais": {
        "labels": [
            "Italy"
        ],
        "data": [
            3
        ]
    }
}

Get User Link Tracking By Code

fetch('https://justanotherlinkcut.com/api/getUserLinkTrackingByCode', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer /* YOUR_ACCESS_TOKEN_HERE */', // Pass BearerToken via Authorization header
    },
    body: JSON.stringify({
        search_code : "https://justanotherlinkcut.com/ABC123",
        selectDays: 90  // 7, 30, 90 days
    })
.then(res => res.json())
.then(console.log);
{
    "totalClicksPorDia": {
        "total_clicks": 3
    },
    "objClicksPorDia": {
        "labels": [
            "2024-11-15",
            "2024-12-03"
        ],
        "data": [
            1,
            2
        ]
    },
    "objClicksPorDispositivo": {
        "labels": [
            "desktop"
        ],
        "data": [
            3
        ]
    },
    "objClicksPorPais": {
        "labels": [
            "Italy"
        ],
        "data": [
            3
        ]
    }
}

TrackLink

fetch('https://justanotherlinkcut.com/api/trackLink', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
    },
    body: JSON.stringify({
        search_code : "https://justanotherlinkcut.com/ABC123",
        selectDays: 90  // 7, 30, 90 days
    })
.then(res => res.json())
.then(console.log);
{
    "totalClicksPorDia": {
        "total_clicks": 3
    },
    "objClicksPorDia": {
        "labels": [
            "2024-11-15",
            "2024-12-03"
        ],
        "data": [
            1,
            2
        ]
    },
    "objClicksPorDispositivo": {
        "labels": [
            "desktop"
        ],
        "data": [
            3
        ]
    },
    "objClicksPorPais": {
        "labels": [
            "Italy"
        ],
        "data": [
            3
        ]
    }
}