API Docs

Create URL POST

Create URL by sending POST data in json format to REST API endpoint: /api/v1/urls

Request

Parameter Type Position # Description
apikey string Header Required Enter your 20-30 characters unique api key.
apisecret string Header Required Enter your 12-20 characters unique api secret.
Content-Type string Header Required 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. Max: 100 characters
redirect_code string Body Optional HTTP redirect codes (301, 302, 303, 304, 307, or 308). Default is 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 is 0 (no branded domain)
tag_id integer Body Optional ID of tag. Default is 0 (no tag)
expires_after integer Body Optional
(Strongly Recommended)
Number of days (URL will expire after X number days from today). Default is 0 (URL will never expire). Max: 3650

Sample request-data json


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

Usage of "expires_after":
If you create your short URL at 2022-10-01 18:05:07 and set expires_after as 30 (means 30 days), then your short URL will expire at 2022-10-31 18:05:07

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
    }
}
											
{
    "status": 400,
    "message": "Bad request. <detailed-error-message-will-go-here.>",
    "data": null
}
											
{
    "status": 429,
    "message": "You have reached max allowed limit of short URLs. Please contact our support team at support@t2mio.com if you have any concerns.",
    "data": null
}