LinkOoo ShrinkOoo

Home

Endpoint: https://shrnk.us.to/api/shrink.php
To get your token sign up or log in here
General Considrations

• API calls in illustrations made using cURL

That doesn't mean that it is the only way to call our API.
You can make the requests by whatever tool you prefer, we used curl here because it is widly used and available for most systems and programing languages.

• Authentications accepted are Bearer and Basic

- You can use either Bearer authentication in an authorization header like Authorization: Bearer 123456789123456789 or Basic authentication either before endpoint url like https://123456789123456789@shrnk.us.to/api/shrink.php or in an authorization header like Authorization: Basic <base 64 code for your token>

• Response will be JSON Object

- if it is successfull request it will have http response code 200 and response will have two child elements: 1) result which value will be 'success' and 2) data which value is request dependant
- if it is failed request it will have http response code other than 200 and response will have two child elements also: 1) result which value will be 'failed' and 2) message which value will explain why this error happened

So you can test the result of the request if it is success or fail by either checking for the response code or by checking the value of the result if it is 'success' or 'failed'.
Sample JSON failed Response:
                    
{
    "result": (string)"failed",
    "message": (string)"<WHY_THIS_ERROR_OCCURED>"
}

GET
cURL Syntax:
curl <YOUR_API_TOKEN>@shrnk.us.to/api/shrink.php?tag=<SOME_TAG>
Authorization:
Auth.

Required
Use your token as a bearer token and supply it via authorization header.
or as a basic auth token and supply it via endpoint url or authorization header.
eg: Bearer 123456789123456789

Parameters:
tag

Optional
Get only shrinkos tagged with this tag. If not supplied, response will get all shrinkos.
eg: ?tag=sample_links

JSON Success Response:
{
    "result": (string)"success",
    "data": (array)
    [
        {
            "title":(string) "My sample shrinko title",
            "shrinko":(string) "https://shrnk.us.to/abcde",
            "linko":(string) "https://really.long/link/that/you/are/going/to/shrink/and/keep/track/of/clicks/and/visits/to.it",
            "tag":(string) "sample_links",
            "created_at":(datetime) "2024-01-01 00:00:00",
            "clicks":(int) 0
        },
        {
            "title": "another.long",
            "shrinko": "https://shrnk.us.to/1234",
            "linko": "https://another.long/link/that/you/are/going/to/shrink/and/keep/track/of/clicks/and/visits/to.it",
            "tag": null,
            "created_at": "2023-01-01 00:00:00",
            "clicks": 20
        },
        ......
    ]    
}
POST
cURL Syntax:
curl \
-X POST \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'link=<YOUR_LONG_LINK_TO_SHRINK>' \
-d 'title=<DESIRED_SHRINKO_TITLE>' \
-d 'tag=<TAGGING_SHRINKO>' \
https://<YOUR_API_TOKEN>@shrnk.us.to/api/shrink.php
Authorization:
Auth.

Optional
Use your token as a bearer token and supply it via authorization header.
or as a basic auth token and supply it via endpoint url or authorization header.
If supplied, link will be shrinked and added to your account, if not supplied link will be shrinked anonymously.
eg: https://123456789123456789@shrnk.us.to/api/shrink.php

Parameters:
link

Required
The complete link to shrink starting by http or https.
If you shrinked the same link before it will update title and tag with the new provided values, otherwise it will generate new shrinko.
eg: https://very.long/url/that/will/be/shrinked

title

Optional
The desired title for the shrinko.
Ignored if shrinking anonymously. and if not provided with authorized request, the title would be the host of the link.
eg: My link

tag

Optional
Tag for the shrinko for easy sorting.
Ignored if shrinking anonymously.
eg: sample_links

JSON Success Response:
{
    "result": (string)"success",
    "data": (object)
    {
        "title":(string) "My link",
        "shrinko":(string) "https://shrnk.us.to/abcde",
        "linko":(string) "https://very.long/url/that/will/be/shrinked",
        "tag":(string) "sample_links",
        "creation":(datetime) "2024-01-01 00:00:00",
        "action":(enum("created", "updated", "unchanged")) "created"
    }
}
DELETE
cURL Syntax:
curl \
-X DELETE \
-H 'Authorization: Bearer <YOUR_API_TOKEN>' \
https://shrnk.us.to/api/shrink.php?shrinko=<SHRINKO_TO_BE_DELETED>
Authorization:
Auth.

Required
Use your token as a bearer token and supply it via authorization header.
or as a basic auth token and supply it via endpoint url or authorization header.
eg: Bearer 123456789123456789

Parameters:
shrinko

Required
The shrinko you want to delete supplied via GET (by adding it to the end of api endpoit).
eg: ?shrinko=https://shrnk.us.to/abcde

JSON Success Response:
{
    "result": (string)"success",
    "data": (object)
    {
        "deleted":(string) "https://shrnk.us.to/abcde"
    }
}