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 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
If you create your short URL at
2023-09-25 20:14:17
and set expires_after
as 30
(means 30 days), then your short URL will expire at 2023-10-25 20:14:17
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 }