API Docs

Create URL POST

This endpoint allows you to a create new short URL.

https://t2mio.com/api/v1/urls

Request

Parameter Type Position Constraint Description
apikey string Header Required Your 20-30 characters unique api key.
apisecret string Header Required Your 12-20 characters unique api secret.
Content-Type string Header Required Value: application/json
destination string Body Required The destination URL that you want to transform into short URL.
slashtag string Body Optional The keyword for your branded short URL.
Allowed Chars: upper/lowercase letters, digits, at-sign, dot, hyphens and underscore /[^a-z@\._\-0-9]/i.
Default: <auto-generated>
slashtag_length integer Body Optional Characters length for <auto-generated> slashtag.
Min: 3 and Max: 100
Default: 7
redirect_code integer Body Optional HTTP redirect codes (301, 302, 303, 304, 307, or 308).
Default: 301
password string Body Optional Password to protect URL and default is no password.
Max: 50 characters
domain_id integer Body Optional ID of branded short domain.
Default: 0 (no branded domain)
tag_id integer Body Optional ID of tag.
Default: 0 (no tag)
expires_after integer Body Optional
(Strongly Recommended)
Number of days (URL will expire after X number days from today).
Max: 3650
Default: 0 (URL will never expire)

Sample request data (minimal)

{
    "destination":"https://t2mio.com/blog/google-url-shortener-goo-gl-shutting-down/"
}

Sample request data (full)

{
    "destination":"https://t2mio.com/blog/google-url-shortener-goo-gl-shutting-down/",
    "slashtag":"googl_t2m",
    "redirect_code":301,
    "password":"abc456",
    "domain_id":123,
    "tag_id":101,
    "expires_after":90
}

Usage of expires_after

If you create your short URL at 2024-11-21 09:47:01 and set expires_after as 30 (means 30-days),
                then your short URL will expire at 2024-12-21 09:47:01
            

Response

{
    "status": 200,
    "message": "ok",
    "data": {
        "id": 114,
        "destination": "https://t2mio.com/blog/google-url-shortener-goo-gl-shutting-down/",
        "hits": 0,
        "redirectCode": 301,
        "shortUrl": "http://google.com/googl_t2m",
        "slashtag": "googl_t2m",
        "password": "Yes",
        "createdAt": "2018-06-16 06:49:52"
    }
}

With conditional tagId param. Tag ID param will be included in the response only if the URL has a tag.

{
    "status": 200,
    "message": "ok",
    "data": {
        "id": 114,
        "destination": "https://t2mio.com/blog/google-url-shortener-goo-gl-shutting-down/",
        "hits": 0,
        "redirectCode": 301,
        "shortUrl": "http://google.com/googl_t2m",
        "slashtag": "googl_t2m",
        "password": "Yes",
        "createdAt": "2018-06-16 06:49:52",
        "tagId": 110
    }
}