MENU navbar-image

Introduction

Manage your short urls with this API

This documentation aims to provide all the information you need to work with Shrinkly.me API.

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_KEY}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You can retrieve your token by visiting your dashboard and clicking Generate API token under settings.

Url management

APIs for managing Urls

List Urls

requires authentication

Example request:
curl --request GET \
    --get "https://shrinkly.me/api/v1/urls?min_created_at=2024-04-01&max_created_at=2024-05-01" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"
const url = new URL(
    "https://shrinkly.me/api/v1/urls"
);

const params = {
    "min_created_at": "2024-04-01",
    "max_created_at": "2024-05-01",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (302):

Show headers
cache-control: no-cache, private
location: https://shrinkly.me/login
content-type: text/html; charset=UTF-8
access-control-allow-origin: *
 

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="0;url='https://shrinkly.me/login'" />

        <title>Redirecting to https://shrinkly.me/login</title>
    </head>
    <body>
        Redirecting to <a href="https://shrinkly.me/login">https://shrinkly.me/login</a>.
    </body>
</html>
 

Request   

GET api/v1/urls

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Query Parameters

min_created_at   date  optional  

Example: 2024-04-01

max_created_at   date  optional  

Example: 2024-05-01

Get Single Url

requires authentication

Example request:
curl --request GET \
    --get "https://shrinkly.me/api/v1/urls/94" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"
const url = new URL(
    "https://shrinkly.me/api/v1/urls/94"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (302):

Show headers
cache-control: no-cache, private
location: https://shrinkly.me/login
content-type: text/html; charset=UTF-8
access-control-allow-origin: *
 

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="0;url='https://shrinkly.me/login'" />

        <title>Redirecting to https://shrinkly.me/login</title>
    </head>
    <body>
        Redirecting to <a href="https://shrinkly.me/login">https://shrinkly.me/login</a>.
    </body>
</html>
 

Request   

GET api/v1/urls/{url_id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

URL Parameters

url_id   integer   

Example: 94

Get Url Visits or clicks

requires authentication

Example request:
curl --request GET \
    --get "https://shrinkly.me/api/v1/urls/96/visits" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"
const url = new URL(
    "https://shrinkly.me/api/v1/urls/96/visits"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (302):

Show headers
cache-control: no-cache, private
location: https://shrinkly.me/login
content-type: text/html; charset=UTF-8
access-control-allow-origin: *
 

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="0;url='https://shrinkly.me/login'" />

        <title>Redirecting to https://shrinkly.me/login</title>
    </head>
    <body>
        Redirecting to <a href="https://shrinkly.me/login">https://shrinkly.me/login</a>.
    </body>
</html>
 

Request   

GET api/v1/urls/{url_id}/visits

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

URL Parameters

url_id   integer   

Example: 96

min_created_at   date  optional  

Example: 2024-02-22

max_created_at   date  optional  

Example: 2024-03-22

countries   string  optional  

comma separated ISO country codes Example: US,IN

Shrink a Url

requires authentication

Example request:
curl --request POST \
    "https://shrinkly.me/api/v1/urls" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"url\": \"https:\\/\\/linkedin.com\",
    \"alias\": \"abc123\",
    \"password\": \"12345\",
    \"access_action\": \"allow\",
    \"countries\": \"[\\\"US\\\",\\\"IN\\\"]\"
}"
const url = new URL(
    "https://shrinkly.me/api/v1/urls"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "url": "https:\/\/linkedin.com",
    "alias": "abc123",
    "password": "12345",
    "access_action": "allow",
    "countries": "[\"US\",\"IN\"]"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Example response (200):


{
    "data": {
        "id": 8,
        "user_id": 11,
        "short": "shrinkly.me/UYZCAi",
        "long": "https://www.quigley.com/beatae-rem-non-excepturi-vero-minima-ut-molestias",
        "status": "enabled",
        "password": null,
        "access_action": null,
        "access_countries": null,
        "created_at": "2024-11-25T16:49:50.000000Z"
    }
}
 

Request   

POST api/v1/urls

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

url   string   

Example: https://linkedin.com

alias   string  optional  

Custom url alias Example: abc123

password   string  optional  

Must be at least 3 characters Example: 12345

access_action   string  optional  

Choose whether to "allow" or "block" specified countries
Example: allow

countries   string[]  optional  

ISO codes of Countries you want to allow or block
Example: ["US","IN"]

Delete Url

requires authentication

Example request:
curl --request DELETE \
    "https://shrinkly.me/api/v1/urls/97" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"
const url = new URL(
    "https://shrinkly.me/api/v1/urls/97"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

Request   

DELETE api/v1/urls/{url_id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

URL Parameters

url_id   integer   

The ID of the url you want to delete
Example: 97

Update a Url

requires authentication

Example request:
curl --request PUT \
    "https://shrinkly.me/api/v1/urls/94" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"url\": \"https:\\/\\/linkedin.com\",
    \"alias\": \"abc123\",
    \"password\": \"12345\",
    \"access_action\": \"block\",
    \"countries\": \"[\\\"US\\\",\\\"IN\\\"]\"
}"
const url = new URL(
    "https://shrinkly.me/api/v1/urls/94"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "url": "https:\/\/linkedin.com",
    "alias": "abc123",
    "password": "12345",
    "access_action": "block",
    "countries": "[\"US\",\"IN\"]"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Request   

PUT api/v1/urls/{url_id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

URL Parameters

url_id   integer   

The ID of the url you want to update. Example: 94

Body Parameters

url   string  optional  

The new long url Example: https://linkedin.com

alias   string  optional  

The new custom url alias Example: abc123

password   string  optional  

The new password. It must be at least 3 characters Example: 12345

access_action   string  optional  

The new access action Example: block

countries   string[]  optional  

The new ISO codes of countries to allow or block
Example: ["US","IN"]